QUICK QUESTION FOR SOMEONE
CODE
<?php
$con = mysql_connect("localhost","kenbob_Ken","Ken");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
if (mysql_query("CREATE DATABASE my_db",$con))
{
echo "Database created";
}
ERROR
Error creating database: Access denied for user 'kenbob_Ken'@'localhost' to database 'my_db'
Question: This is from an example. It is true that you have to go the the mySQL Databases to create a database. It it true you can not create it in your script or is it because this is the no-add web page thing?
Here is all the code: (it is the 2nd <?php that bombed!
<?php
$con = mysql_connect("localhost","kenbob_Wayne","Wayne");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
mysql_close($con);
?>
<?php
$con = mysql_connect("localhost","kenbob_Ken","Ken");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
if (mysql_query("CREATE DATABASE my_db",$con))
{
echo "Database created";
}
else
{
echo "Error creating database: " . mysql_error();
}
mysql_close($con);
?>
CODE
<?php
$con = mysql_connect("localhost","kenbob_Ken","Ken");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
if (mysql_query("CREATE DATABASE my_db",$con))
{
echo "Database created";
}
ERROR
Error creating database: Access denied for user 'kenbob_Ken'@'localhost' to database 'my_db'
Question: This is from an example. It is true that you have to go the the mySQL Databases to create a database. It it true you can not create it in your script or is it because this is the no-add web page thing?
Here is all the code: (it is the 2nd <?php that bombed!
<?php
$con = mysql_connect("localhost","kenbob_Wayne","Wayne");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
mysql_close($con);
?>
<?php
$con = mysql_connect("localhost","kenbob_Ken","Ken");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
if (mysql_query("CREATE DATABASE my_db",$con))
{
echo "Database created";
}
else
{
echo "Error creating database: " . mysql_error();
}
mysql_close($con);
?>