I have this code as part of a function but for any reason the while loop is not running. This is the code:
$get = "SELECT * FROM ".TBL." WHERE test = '1' && (test = '".$fieldx['ShortVersion']."' || test2 = '".$fieldx['ShortVersion']."' || test3 = '".$fieldx['ShortVersion']."' || test4 = '".$fieldx['ShortVersion']."')";
$getprocess = mysql_query($get) or die(mysql_error());
echo "<br>Awarding ...";
//Debug ready till here
while($getup = mysql_fetch_array($getprocess)) {
// This does not run
};
When I add or die(“error”.mysql_error()) to the mysql_fetch_array(), it shows “error” but nothing related to mysql. Can someone help please?
Well try not to use MySQL extensions such as mysql_query and mysql_fetch_array as they are deprecated. Instead, use mysqli or PDO classes/objects will significantly improve your script.
For your problem, it seems that the query did not return any results. Either there is no record with the criterion you specify, or that there is a syntax error in SQL string.
Where you concatenate the table name into your query ( $get = "SELECT * FROM ". TBL . "WHERE…) it does not have a $ symbol in front of the TBL variable. Maybe that is causing a problem.