torvald_helmer Posted May 2, 2007 Share Posted May 2, 2007 I want to select a row from a table where, e.g. name='george' instead of writing 'george', can I use a variable like this?: $xx = "george"; $result= mysql_query("SELECT * FROM Names WHERE name=$xx"); does this work? I know I could try this on my own, but I do not have access to a database to test with, and I am wondering if this is possible... Link to comment https://forums.phpfreaks.com/topic/49693-select-from-table/ Share on other sites More sharing options...
pikemsu28 Posted May 2, 2007 Share Posted May 2, 2007 yes that will work but you need to add one thing to your query $result= mysql_query("SELECT * FROM Names WHERE name='$xx'");//add ' around the variable Link to comment https://forums.phpfreaks.com/topic/49693-select-from-table/#findComment-243649 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.