Jump to content

[SOLVED] Stumped on this query


jaxdevil

Recommended Posts

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

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.

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.