Jump to content

Blank Output!


phpcod3r

Recommended Posts

<?
$username="cnt";
$password="hi";
$database="contacts";

mysql_connect(localhost,$username,$password);
mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM contacts";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

echo "<b><center>Database Output</center></b><br><br>";

$i=0;
while ($i < $num) {

$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$phone=mysql_result($result,$i,"phone");
$mobile=mysql_result($result,$i,"mobile");
$fax=mysql_result($result,$i,"fax");
$email=mysql_result($result,$i,"email");
$web=mysql_result($result,$i,"web");

echo "<b>$first $last</b><br>Phone: $phone<br>Mobile: $mobile<br>Fax: $fax<br>E-mail: $email<br>Web: $web<br><hr><br>";

$i++;
}

?>

 

The above code is placed in gb.php and when i run it on my XAMPP lite it just shows Database Output text and the rest of the page is blank, where can be the problem.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/37588-blank-output/
Share on other sites

<?
$username="cnt";
$password="hi";
$database="contacts";

mysql_connect(localhost,$username,$password);
mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM contacts";
$result=mysql_query($query);

$num=mysql_numrows($result);

echo "<b><center>Database Output</center></b><br><br>";

while ($row = mysql_fetch_assoc( $result ) ) {

$first=$row['first'];
$last=$row['last'];
$phone=$row['phone'];
$mobile=$row['mobile'];
$fax=$row['fax'];
$email=$row['email'];
$web=$row['web'];

echo "<b>$first $last</b><br>Phone: $phone<br>Mobile: $mobile<br>Fax: $fax<br>E-mail: $email<br>Web: $web<br><hr><br>";

}

mysql_close();

?>

Link to comment
https://forums.phpfreaks.com/topic/37588-blank-output/#findComment-179997
Share on other sites

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.