newbie db connection

admin

Administrator
Staff member
I a newbie to php and having trouble connecting to my database.

The following is the script that I use to connect:

<?

if ((!$f_name) || (!$l_name) || (!$username) || (!$password)) {
header("Location: show_adduser.html");
exit;
}
echo "step 1";
$db_name = "DBMSQLA";
$table_name = "user";
echo "db variables";
$connection = mysql_connect("db.cari.net", "dbadmin", "shante")
or die("Couldn't connect.");
echo "step connection";
$db = mysql_select_db($db_name, $connection)
or die("Couldn't select database.");
echo "step connected";

$sql = "INSERT INTO $table_name
(f_name, l_name, username, password)
VALUES
(\"$f_name\", \"$l_name\",\"$username\",password(\"$password\"))
";

$result = mysql_query($sql,$connection)
or die("Couldn't execute query.");

?>


I get the following error:

Fatal error: Call to unsupported or undefined function mysql_connect() in /home/sites/site1/web/test/do_adduser.php on line 11

Can anyone tell me what is wrong?

Note I am running a cobalt raq3 server running red hat and using mysql as the db
 
Back
Top