Re: A little advise please

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--- denis@comtechservices.com 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>
>         <TITLE>This 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 
> database<BR>\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("<BR>The table creation was a success!");
>                 } else {
>                 print("<BR>Sorry, 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
> denis@comtechservices.com
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


=====
Mark Weinstock
mark_weinstock@yahoo.com
***************************************
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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux