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>
assaultkittyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

if( mysql_query("CREATE DATABASE $DBName") ) {
0
assaultkittyAuthor Commented:
Why do I have to use these function?  Are they deprecated function?
0
DerokorianCommented:
Look at the error you get - mysql_create_db IS NOT a function in php. Unless you were define it as such, which, again, according to your error you haven't. I'm providing you with options that work with functions built into PHP already.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
assaultkittyAuthor Commented:
Very fast response.  Thank you!!!!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.