mitwess Posted November 11, 2009 Share Posted November 11, 2009 i can't seem to get the following query to work. select $q1c from $vote_rate where id = $recent_record LIMIT 0,1 ; this method did not work either select .$q1c. from .$vote_rare. where id = .$recent_record. LIMIT 0,1 ; i did get $q_o = " AND id=".$rand." ORDER BY id asC LIMIT 1"; "SELECT ".$answer2." FROM vote_rare WHERE".$q_o; to run, i.e. not crash my script but then i don't get any result from $answer_db = $row['$answer2']; any ideas? Link to comment https://forums.phpfreaks.com/topic/181105-problems-with-php-variables-in-mysql-query/ Share on other sites More sharing options...
Mchl Posted November 11, 2009 Share Posted November 11, 2009 You should show us some more code. Link to comment https://forums.phpfreaks.com/topic/181105-problems-with-php-variables-in-mysql-query/#findComment-955552 Share on other sites More sharing options...
mitwess Posted November 11, 2009 Author Share Posted November 11, 2009 i changed some stuff to make things easier to follow in my previous post, but here's the actual code... $question = $_REQUEST['question']+1; $guess = $_REQUEST['guess']; $rating = $_REQUEST['rate']; $last_user = $_REQUEST['last_user']; $answer = array("q1a", "q1b", "q1c", "q1d", "q1e", "q1f", "q2a", "q2b", "q2c", "q2d", "q2e", "q2f", "q3a", "q3b", "q3c", "q3d", "q3e", "q3f", "q4a", "q4b", "q4c", "q4d", "q4e", "q4f"); $rand = rand(68545,88000); $answer2 = $answer[$question-1]; $q_o = " AND id=".$last_user." LIMIT 0,1"; $query = "SELECT ".$answer2." FROM face_rate WHERE 1 .$q_o; $answer_db = $row['$answer2']; --------------- not that the above is working... but that's what i got right now Link to comment https://forums.phpfreaks.com/topic/181105-problems-with-php-variables-in-mysql-query/#findComment-955554 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.