Can connect but can't do anything else..

admin

Administrator
Staff member
Hi all,

I am trying to connect to MySQL with PHP4 on my local machine(Redhat 7.0) and experiment with inserting, deleting and updating records but I can't seem to figure out what I am doing wrong. I know I am connecting to the database because it is showing me the success string below, but I don't know what I am doing wrong. Please help. Here is my code:

<?php
//db_connect.php

include "common_db.inc";
error_reporting(0);

$link_id = db_connect("phptest");
if (!$link_id) {
die (sql_error());
}

else echo "Successfully made a connection to $dbhost . <br>";

$result = mysql_query("SELECT * FROM user" , $link_id);
$num_rows = mysql_num_rows($result);
echo "The user database contains $num_rows rows.";

?>

It won't display any info from the database at all.

Scott
 
Back
Top