Having problem in sql query execution

Posted by Rishi2686 on Stack Overflow See other posts from Stack Overflow or by Rishi2686
Published on 2010-06-03T09:49:49Z Indexed on 2010/06/03 9:54 UTC
Read the original article Hit count: 214

Hi there,

I have a problem in sql query execution.I am using this sql query:

$userid = 1;

$sql = mysql_query("
  SELECT ID, Nm, Address, date_format(DateOfBirth, '%d%M%Y') as DateOfBirth 
  FROM PersonalDetails where UserMasterID = $userid
") or die (mysql_error());

The result appears as:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= ' at line 1

When I execute this in PHPMyAdmin it works properly. I am using mysql(5.0.5b) and PHP (5.2.6)

Can you help me please?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql