List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 15 2001 1:26pm
Subject:Re: PHP and SQL
View as plain text  
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.

><TITLE>Creating a Database</TITLE>
>// 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
>} else {
>  	print ("The database, $DBName, could not be created!<BR>\n");
>mysql_close ($Link);
>Before posting, please check:
>   (the manual)
>           (the list archive)
>To request this thread, e-mail <mysql-thread85588@stripped>
>To unsubscribe, e-mail <>
>Trouble unsubscribing? Try:

Paul DuBois, paul@stripped
PHP and SQLmike15 Sep
  • Re: PHP and SQLPaul DuBois15 Sep
  • Re: PHP and SQLDeryck Henson15 Sep