Hyperjase Posted January 8, 2012 Share Posted January 8, 2012 Hey all, Trying to search for something within a database, using two different fields, one text box and one drop down (the values are actually table names). Here is what I have, this doesn't work: <?php $result = mysql_query("SELECT * FROM cakeorder WHERE `{$_SESSION['name']}` = '".$_SESSION['search']. "'"); Thanks! Jason Quote Link to comment https://forums.phpfreaks.com/topic/254610-use-_session-within-mysql-search/ Share on other sites More sharing options...
PaulRyan Posted January 8, 2012 Share Posted January 8, 2012 Try echoing out the $_SESSION variables and the query to make sure they are what you expect. Regards, PaulRyan. Quote Link to comment https://forums.phpfreaks.com/topic/254610-use-_session-within-mysql-search/#findComment-1305591 Share on other sites More sharing options...
Hyperjase Posted January 8, 2012 Author Share Posted January 8, 2012 My boob, it was outputting correctly, I had the search the wrong way round and needed to change ' for ` on the table name! Thanks, Jason Quote Link to comment https://forums.phpfreaks.com/topic/254610-use-_session-within-mysql-search/#findComment-1305595 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.