At 4:50 PM +1000 9/15/01, mike wrote:
>I am new to both PHP and MySQL (I have experience in ASP) and am trying
>to get my server running both. I can connect to the MySQL server under
>DOS using the command line and can create new databases this way. I want
>to create a web data site so I need to accomplish this via HTML. I have
>tried to follow the instruction in various books without success. Can
>anyone help with advice?
>
>Below is the simple code I am using that the book tells me should work
>but it doesn't.

Try printing the results of mysql_error($Link) and mysql_errno($Link)
to see what the problem is.  Or are you getting a syntax error, or what?
You don't mention what actually happens, other than "doesn't work."

The script will of course fail if the database already exists.

>
><HTML>
><HEAD>
><TITLE>Creating a Database</TITLE>
></HEAD>
><BODY>
><?php
>// Set the variables for the database access:
>$Host = "localhost";
>$User = "root";
>//$Password = ""; (no password set at this stage)
>$DBName = "testbase2";
>
>$Link = mysql_connect ($Host, $User);
>if (mysql_create_db ($DName, $Link)) {
>       print ("The database, $DBName, was successfully
>created!<BR>\n");
>} else {
>       print ("The database, $DBName, could not be created!<BR>\n");
>}
>mysql_close ($Link);
>?>
></BODY>
></HTML>
>
>TIA
>
>Mike
>
>
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail <[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-- 
Paul DuBois, [EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to