create new db in mysql with php syntax

Posted by Jacksta on Stack Overflow See other posts from Stack Overflow or by Jacksta
Published on 2010-04-18T06:11:24Z Indexed on 2010/04/18 6:13 UTC
Read the original article Hit count: 403

Filed under:
|
|
|

I am trying to create a new db called testDB2, below is my code. Once running the script all I am getting an error on line 7

Fatal error: Call to undefined function mysqlquery() in /home/admin/domains/domain.com.au/public_html/db_createdb.php on line 7

This is my code

<?
$sql = "CREATE database testDB2";

$connection = mysql_connect("localhost", "admin_user", "pass")
    or die(mysql_error());

$result = mysqlquery($sql, $connection) 
    or die(mysql_error());

if ($result) {
    $msg = "<p>Databse has been created!</p>";
}
?>

<HTML>
<head>
<title>Create MySQL database</title>
</head>
<body>

<? echo "$msg"; ?>

</body>
</HTML>

© Stack Overflow or respective owner

Related posts about php

Related posts about php5