Jump to content

Post variables in mysql_query failing


Mavent

Recommended Posts

This works:

$result = mysql_query("SELECT * FROM mydatabase WHERE username = 'billybob'");

 

This does not:

$user = "billybob"

$result = mysql_query("SELECT * FROM mydatabase WHERE username = $user");

 

Shouldn't these be identical?  If I echo $user, I get, of course, "billybob", so does anyone know why the variable isn't working in the query itself?

Link to comment
https://forums.phpfreaks.com/topic/258422-post-variables-in-mysql_query-failing/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.