I am having a hard time trying to figure out how to fix the syntax in the code below.
$key = 4;
$column = "five_year";
$query_for_rate = "SELECT $column key FROM $usertable WHERE key=$key";
$get_rate = mysql_query($query_for_rate) or die(mysql_error());
echo $query_for_rate. "<br>";
echo $get_rate;
if($get_rate){
while($row = mysql_fetch_array($get_rate)){
echo $row;
}
}
error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key FROM current_rates WHERE key=4' at line 1
Thank you for the replies. The query is now working, I think. When I echo $get_rate I get "Resource id #5". My problem now is I cannot get my while loop to produce any results. Thank you!