I tried to create a mysql database from php with the following code (with my password and username filled in):
<?php
$connection = mysql_connect('localhost', 'username', 'password');
if (!$connection)
{
die('Could not connect: ' . mysql_error());
}
if (mysql_create_db('my_db'))
{
echo "Database created successfully
";
}
else
{
echo 'Error creating database: ' . mysql_error() . "
";
}
?>
but I got the following error message:
Fatal error: Call to undefined function: mysql_create_db() in /home/goldy/public_html/test.php on line 10
Can someone tell me what I’m doing wrong? The hosting service I use has both mysql and php installed and working.
Thanks for you help,
Matt :h: