Page 1 of 1

mysql_connect question

Posted: Fri Aug 22, 2003 5:53 pm
by kermit
Hi, I am learning how to connect to mysql with php, and so I was trying to use a little connect script that looks like this:

Code: Select all

<?php

$username = "username....";
$password = "pass....";
$hostname = "localhost";	

$link = mysql_connect($hostname, $username, $password) 
	or die("Unable to connect to MySQL");
print ( "Connected to MySQL" );

mysql_close($link);

?>

Now when I try and open this script in my browser, I get this message:

Fatal error: Call to undefined function: mysql_connect() in /var/www/html/connect.php on line 7
Any suggestions as to what might be wrong?

thanks

kermit

Posted: Fri Aug 22, 2003 11:01 pm
by trollll
That leads me to believe that the mysql option did not get enabled upon installation. Can you upload a file with contents of

Code: Select all

<?php phpinfo(); ?>
so we can check out the installation settings?

Posted: Sat Aug 23, 2003 8:50 am
by kermit
That is exactly what was wrong - I did not install with the MySQL option. I was quite pleased to find that I could upgrade it with my install disk, and it was all quite painless. I ran the script again, and it works just fine. Thanks for your help.