jaxdevil Posted November 14, 2007 Share Posted November 14, 2007 Ths screen just comes up blank, I tried adding the die statement to it and it doesn't display anything. Anyone able to figure this one out? thanks in advance guys. <?php $db_host = "localhost"; $db_user = "auction_asset"; $db_pwd = "xxxxxx"; $db_name = "auction_asset"; mysql_connect($db_host, $db_user, $db_pwd); mysql_select_db($db_name); ?> <?php $sql = "SELECT * FROM equipment WHERE tag=$lot"; $query = mysql_query($sql); $tag = $row['tag']; $descrip = $row['descrip']; while($row = mysql_fetch_array($query)) or die('Query failed: ' . mysql_error()) { echo "<center>"; echo "$tag<br>"; echo "$descrip<br><br>"; echo "Is the above information correct?<br>"; echo "<form method=\"post\" action=\"bidrec2.php\">"; echo "<input type=\"hidden\" name=\"tag\" value=\"$tag\">"; echo "<input type=\"hidden\" name=\"descrip\" value=\"$descrip\">"; echo "<input type=\"submit\" value=\"Continue\">"; echo "</form>"; } ?> Link to comment https://forums.phpfreaks.com/topic/77346-solved-stumped-on-this-query/ Share on other sites More sharing options...
cooldude832 Posted November 14, 2007 Share Posted November 14, 2007 check what $lot is and before your whlie loop add a bit of logic if(mysql_num_rows($result) >0){ while{ } else{ echo "No records found"; } Link to comment https://forums.phpfreaks.com/topic/77346-solved-stumped-on-this-query/#findComment-391573 Share on other sites More sharing options...
GingerRobot Posted November 14, 2007 Share Posted November 14, 2007 You have your or die statement on the wrong part. Try: <?php $db_host = "localhost"; $db_user = "auction_asset"; $db_pwd = "xxxxxx"; $db_name = "auction_asset"; mysql_connect($db_host, $db_user, $db_pwd); mysql_select_db($db_name); ?> <?php $sql = "SELECT * FROM equipment WHERE tag=$lot"; $query = mysql_query($sql) or die('Query failed: ' . mysql_error()); $tag = $row['tag']; $descrip = $row['descrip']; while($row = mysql_fetch_array($query)){ echo "<center>"; echo "$tag<br>"; echo "$descrip<br><br>"; echo "Is the above information correct?<br>"; echo "<form method=\"post\" action=\"bidrec2.php\">"; echo "<input type=\"hidden\" name=\"tag\" value=\"$tag\">"; echo "<input type=\"hidden\" name=\"descrip\" value=\"$descrip\">"; echo "<input type=\"submit\" value=\"Continue\">"; echo "</form>"; } ?> The reason for the blank screen is that your previous code gives a parse error - evidently you have display_errors set to off, and hence recieve no error message - just a blank screen. Link to comment https://forums.phpfreaks.com/topic/77346-solved-stumped-on-this-query/#findComment-391575 Share on other sites More sharing options...
jaxdevil Posted November 14, 2007 Author Share Posted November 14, 2007 I had the variable = in the wrong place. the correct place was within the loop, not before it. Thanks for the help though guys SK Link to comment https://forums.phpfreaks.com/topic/77346-solved-stumped-on-this-query/#findComment-391587 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.