0

I'm trying to test a piece of code but all I get is a white screen I don't know why :S here it is:

<?php
require_once 'login.php';
$db_server = mysql_connect($db_hostname, $db_username, $db_password);

if (!$db_server) die("Unable to connect to MySQL: " . mysql_error());

mysql_select_db($db_database)
    or die("Unable to select database: " . mysql_error());

$query = "SELECT * FROM classics";
$result = mysql_query($query);

if (!$result) die ("Database acces failed: " . mysql_error());

$rows = mysql_num_rows($result);

for ($j = 0; $j < $rows; ++$j)
{
    echo 'Author: ' . mysql_result($result,$j,'author') . '<br/>';
    echo 'Title: ' . mysql_result($result,$j,'title') . '<br/>'
    echo 'Category: ' . mysql_result($result,$j,'category') . '<br/>'
    echo 'Year: ' . mysql_result($result,$j,'year') . '<br/>'
    echo 'ISBN: ' . mysql_result($result,$j,'isbn') . '<br/>'
}

?>

I don't understand what's wrong

and the login

<?php
$db_hostname = 'localhost';
$db_database = 'publications';
$db_username = 'tony';
$db_password = 'mypasswd';
?>

Im learning how to make dynamic websites, I need a mentor if anyone's interested

sol_keys
  • 13
  • 5

0 Answers0