Link to home
Start Free TrialLog in
Avatar of assaultkitty
assaultkitty

asked on

Newsletter PHP

I am having problems with this program.  @ this line if (mysql_create_db($DBName, $DBConnect) === FALSE)

The error is
( ! ) Fatal error: Call to undefined function mysql_create_db() in C:\wamp\www\9780538745840_Data\PHP_Projects\Chapter.08\Chapter\CreateNewsLetter.php on line 19

Can you help me?



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Create Newsletter Database</title>
<meta http-equiv="content-type"
      content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
$DBName = "newsletter";
$DBConnect = mysql_connect("localhost", "root", "");
if ($DBConnect === FALSE)
      echo "<p>Connect error: "
            . myqsql_error() . "</p>\n";
      else
      {
            if (mysql_create_db($DBName, $DBConnect) === FALSE)
                  echo "<p>Could not create the \"$DBName\" " .
                  "database: " . mysql_error($DBConnect) .
                  "</p>\n";
            else
                  echo "<p>Successfully created the " .
                        "\"$DBName\" database.</p>\n";
            mysql_close($DBConnect);
      }
?>

</body>
</html>
Avatar of Derokorian
Derokorian
Flag of United States of America image

I believe you are looking to use mysql_select_db as that is a real function and mysql_create_db is not.
Tho it appears you are looking to create a DB so  you would issue a query for that:

if( mysql_query("CREATE DATABASE $DBName") ) {
Avatar of assaultkitty
assaultkitty

ASKER

Why do I have to use these function?  Are they deprecated function?
ASKER CERTIFIED SOLUTION
Avatar of Derokorian
Derokorian
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Very fast response.  Thank you!!!!!