RE: [PHP-DB] A little advise please

2002-12-11 Thread Edward Peloke
change this part so that $query is capitalized

if (mysql_db_query ($DBName, $query, $Link)){

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 11, 2002 11:23 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] A little advise please


Hello,
I have a bit of problem with a script . . . looking for help.  The 
script pretty much works as it creates the table I want,  However, 
the display is incorrect as it states the creation was unsuccessful. 
Here is the actual script:

HTML
HEAD
TITLEThis PHP script creates a table called Feedback in a 
database called livetest/TITLE
BODY
?php
$Host=localhost;
$User=root;
$Pasword=;
$DBName=livetest;
$TableName=$Name;

if ($Link=mysql_connect($Host, $User, $Password)){
print(Successfully connected to the 
databaseBR\n);
}else{
print (Sorry, we did not successfully connect to the 

database.BR\n);
}

$Query=CREATE TABLE $TableName (ID INT UNSIGNED NOT 
NULL AUTO_INCREMENT PRIMARY KEY, FirstName TEXT,
LastName TEXT, Email TEXT, Comments TEXT);

if (mysql_db_query ($DBName, $query, $Link)){
print(BRThe table creation was a success!);
} else {
print(BRSorry, the table was not created 
successfully.);
}

mysql_db_query ($DBName, $Query, $Link);

mysql_close($Link);

?
/BODY
/HTML

Now, as I said, the table does get created.  But the output says:

Successfully connected to the database

Sorry, the table was not created successfully. 

What on earth am I doing wrong?

Thanks for the help (in advance).
Denis Lahaie
[EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] A little advise please

2002-12-11 Thread Mark
You're trying to run the query twice. The first time, you're using a
lowercase q in $query, which will fail because you have defined it as
$Query. Then you're calling the function again with $Query, wihch is
why the table is getting created. You shouldn't be calling it twice,
and you need to be careful about capitalization in variable names.

HTH,

Mark

--- [EMAIL PROTECTED] wrote:
 Hello,
 I have a bit of problem with a script . . . looking for help.  The 
 script pretty much works as it creates the table I want,  However, 
 the display is incorrect as it states the creation was
 unsuccessful. 
 Here is the actual script:
 
 HTML
 HEAD
 TITLEThis PHP script creates a table called Feedback in a
 
 database called livetest/TITLE
 BODY
 ?php
 $Host=localhost;
 $User=root;
 $Pasword=;
 $DBName=livetest;
 $TableName=$Name;
 
 if ($Link=mysql_connect($Host, $User, $Password)){
 print(Successfully connected to the 
 databaseBR\n);
 }else{
 print (Sorry, we did not successfully connect to
 the 
 
 database.BR\n);
 }
 
 $Query=CREATE TABLE $TableName (ID INT UNSIGNED
 NOT 
 NULL AUTO_INCREMENT PRIMARY KEY, FirstName TEXT,
 LastName TEXT, Email TEXT, Comments TEXT);
 
 if (mysql_db_query ($DBName, $query, $Link)){
 print(BRThe table creation was a success!);
 } else {
 print(BRSorry, the table was not created 
 successfully.);
 }
 
 mysql_db_query ($DBName, $Query, $Link);
 
 mysql_close($Link);
 
 ?
 /BODY
 /HTML
 
 Now, as I said, the table does get created.  But the output says:
 
 Successfully connected to the database
 
 Sorry, the table was not created successfully. 
 
 What on earth am I doing wrong?
 
 Thanks for the help (in advance).
 Denis Lahaie
 [EMAIL PROTECTED]
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to fight to death to 
defend everyone else's right to the same thing.
-Stolen from the now-defunct Randy's Random mailing list.
***

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php