Web Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsWeb DesignWeb Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 2nd, 2006, 06:21 PM
benzspida benzspida is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 3 benzspida User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m 35 sec
Reputation Power: 0
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>

Reply With Quote
  #2  
Old April 3rd, 2006, 09:07 AM
Spongy's Avatar
Spongy Spongy is offline
Alternately High
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Hilversum, Netherlands
Posts: 223 Spongy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 56 m 41 sec
Reputation Power: 5
Send a message via MSN to Spongy
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:
 $connection= @mysql_connect ("localhost""craig""1978") or die (mysql_error()); 


Cheers,

Spongy
__________________
Work to live, don't live to work

Reply With Quote
  #3  
Old April 3rd, 2006, 09:24 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsWeb DesignWeb Development > Php&mysql help plz


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT