Jump to content

problems with php variables in mysql query


mitwess

Recommended Posts

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?

 

 

 

 

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

 

 

 

 

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.