<?php
$conn = mysql_connect("localhost","username","password") or die("Couldn't
connect to mysql");
$query = ("CREATE DATABASE db_name");
if (mysql_query($query))
{
echo "<p>The database was created successfully</p>";
}
else
{
echo "<p>The database was not created ".mysql_error()."</p>";
}
?>
If it still gives you the same error, try connecting to mysql from the
console with mysql -u user -ppasswd
Adam
On Tue, 5 Aug 2003, Russell Griechen wrote:
> Newbie here,
> With PhpMyAdmin, What is the syntax for create database?
>
> I have:
>
> $link = mysql_pconnect("hostname", "username", "password")
> or exit("Could not connect");
>
> if (mysql_create_db("Sportsmen")) {
> print ("Database created successfully\n");
> } else {
> printf ("Error creating database: %s\n", mysql_error ());
> }
> /*error
> Error
> MySQL said:
>
>
> You have an error in your SQL syntax near '$link =
> mysql_pconnect(\"64.177.44.120\", \"russgri\", \"sportsme\")
> or' at line 1
>
> Russell Griechen
>
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php