mysql error unknown column in field list

Hey I'm tring the following sql query :

$sql = mysql_query("INSERT INTO feeds (FileLocation,Title,feeddate,nameofuploader,type) 
   VALUES('".mysql_real_escape_string($putItAt)."','".mysql_real_escape_string($_POST['title'])."      ',now(),". $_SESSION['name'] .",'file')")  

but its giving me the error: Unknown column 'Ankit2' in 'field list' where Ankit2 is the value to be inserted Any way around this?

Answers


You forgot to put single quotes around the $_SESSION variable!

$sql = mysql_query("INSERT INTO feeds (FileLocation,Title,feeddate,nameofuploader,type) 
   VALUES('".mysql_real_escape_string($putItAt)."','".mysql_real_escape_string($_POST['title'])."      ',now(),'". $_SESSION['name'] ."','file')") 

Need Your Help

JSON manipulation in PHP?

php json

I need to edit some data in a JSON file, and I'm looking to do so in PHP. My JSON file looks like this:

Best implementation for hashCode method for a collection

java hash equals hashcode

How do we decide on the best implementation of hashCode() method for a collection (assuming that equals method has been overridden correctly) ?