|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Php&mysql help plz
trying to create a new database with 4 table in php $ mysql
cant seem to get the script working can any one help plz this is what i have done so far <html> <head> <title> mysql databser </title> </head> <body> <? php $new_db = "testDB2"; $connection= @mysql_connect ("localhost", "craig", "1978") die (mysql_error()); $result = @mysql_create_db ($new_db, $connection) die (mysql_error()); if ($result) { $msg = "<P>Database has been created!</p>"; print " $result"; } ?> <p> <? echo "$msg"; ?></p> </body> </html> |
|
#2
|
||||
|
||||
|
First of all, you're in the wrong forum. A moderator will fix this I think.
To your problem: Try to put the 'die' statement after your connection string. Like this: PHP Code:
Cheers, Spongy
__________________
Work to live, don't live to work |
|
#3
|
||||
|
||||
|
Yes, in relation to Spongy's advise, I'd like to point out that without the keyword or, you are simply telling the script to stop running after you connect... actually, without a semi-colon on your mysql_connect() line (and no or clause), you're probably getting some goofy error parsing from the PHP engine.
I would follow Spongy's advise and put the or die(mysql_error()) after each line. Personally, I find putting them on the same line is easier to read and less complicated to debug.
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter! DevArticles Forum Moderator "The net is a waste of time, and that's exactly what's right about it." -- William Gibson |
![]() |
| Viewing: Dev Articles Community Forums > Web Design > Web Development > Php&mysql help plz |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|