many time i try to connect PHP forms with MySQL Database but every time i got one message connection is not available.
so my question is that if some one have a knowledge of good tutorial websites then please tell me as i can learn from their
many time i try to connect PHP forms with MySQL Database but every time i got one message connection is not available.
so my question is that if some one have a knowledge of good tutorial websites then please tell me as i can learn from their
<?php
$user="uname";
$pwd="pwd";
$con = mysql_connect("localhost",$user,$pwd);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// Create database
if (mysql_query("CREATE DATABASE my_db",$con))
{
echo "Database created";
}
else
{
echo "Error creating database: " . mysql_error();
}
$selectdb = mysql_select_db("my_db", $con);
if (!$selectdb)
{
die('Database Not selected.');
}
mysql_close($con);
?>
Katty, you could head to the official PHP function reference page for MySQL which is:
http://php.net/manual/en/ref.mysql.php
initially focus on mysql_connect(). There's also some community submitted content, which could come handy for testing.
Also if you could provide the code u are using and error thrown, that would help.