<html>
<head>
<title> My first php page</title>
</head>
<body>
<h1>Firstdb PHP results</h1>
<?php
@ $db=mysql_pconnect('localhost','root','');
if (!$db)
{
echo 'Error could not connect to database';
exit;
}
//check if connection works
if (DB::iserror($db))
{
echo $db->getmessage();
exit;
}
mysql_select_db('firstdb');
$query = "SELECT * FROM table1";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
echo '<p>Number of records found: '.$num_results.'</p>';
?>
</body>
</html>
<head>
<title> My first php page</title>
</head>
<body>
<h1>Firstdb PHP results</h1>
<?php
@ $db=mysql_pconnect('localhost','root','');
if (!$db)
{
echo 'Error could not connect to database';
exit;
}
//check if connection works
if (DB::iserror($db))
{
echo $db->getmessage();
exit;
}
mysql_select_db('firstdb');
$query = "SELECT * FROM table1";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
echo '<p>Number of records found: '.$num_results.'</p>';
?>
</body>
</html>