Code causing content to disappear
Is there anything wrong with the code below?
It's causing a page to return blank results.
Thanks in advance,
John
$querysub = mysql_query("SELECT subcheck FROM submission WHERE submissionid = $submissionid");
$result = mysql_query($querysub);
if (!$result) {
die 'Could not run query: ' . mysql_error();
}
$subcheck = m开发者_JAVA百科ysql_result($result, 0);
Where does $submissionid come from? If it was sent over POST/GET, did you escape it properly before inserting it into that query?
You have a syntax error with die:
die "..."
should really be:
die("My message here" . mysql_error());
I also suggest you do sth. like:
$sql = sprintf("SELECT subcheck FROM submission WHERE submissionid = %d", $submissionid);
$querysub = mysql_query($sql);
I'm not positive, but I think it's the first line... try this:
$querysub = mysql_query("SELECT subcheck FROM submission WHERE submissionid ='".$submissionid."'");
You should quote the value you're looking for, butI dont think php will input the variable definition when you have it within quotes, so you can close the quotes, and use the period (.) to append the variable, then another period to append the closing quote.
精彩评论