Forum Moderators: coopster

Message Too Old, No Replies

Creating New MySQL Database

Basic scripting problems

         

Olly333

9:06 am on May 21, 2009 (gmt 0)

10+ Year Member



hey guys
just learning to use MySQL with PHP
something is wrong with the following script, which is meant to create a new database.

<?php
$con = mysql_connect("localhost","root","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

if (mysql_query("CREATE DATABASE database",$con))
{
echo "Database created";
}
else
{
echo "Error creating database: " . mysql_error();
}

mysql_close($con);
?>

i am using vista with apache, php 5.2, MySQL 5.1

i just need someone to tell me what i'm doing wrong cos i just can't find it

Kings on steeds

9:15 am on May 21, 2009 (gmt 0)

10+ Year Member



well, what was your error?

Olly333

10:03 am on May 21, 2009 (gmt 0)

10+ Year Member



when i goto it in my browser it doesn't show anything.
so it is an issue with the php code but i can't figure out what