List:General Discussion« Previous MessageNext Message »
From:Don Read Date:May 6 1999 1:12pm
Subject:RE: mySQL Error Message
View as plain text  
On 06-May-99 William Urquhart wrote:
> Hi all,
> 
>       This is quite possibly more of a PHP3 issue than mySQL. If this is the
> wrong place I apologise for wasting your time and bandwidth, however I would
> appreciate a point in the right directions as to where I could get some
> assistance on the matter.
> 
> My platform is Windows '98 PSW v4.0
> 
> When I try to create a table using the following:
>       ...
>       $SQL = "CREATE TABLE Categories (ID MEDIUMINT(8) AUTO_INCREMENT PRIMARY
> KEY, Category CHAR(32) NOT NULL)) ;
>       if (mysql_query($SQL, $ret_val))
>               echo ("Table Created...") ;
>       else
>               echo(mysql_error()) ;
>       ...
> 
>       mysql generates a No Database Selected Error Number 1046, what am I
doing
> wrong. the $ret_val parameter in the mysql_query function is the return
> value from the mysql_create_db function.
> 

The create_db does not automatically put you in the context of that database.
you'llhave to do a 

mysql_query("use mydb");
mysql_query($SQL);

  or a 

mysql_db_query("mydb",$SQL)

Regards,

---
Don Read                                 sysop@stripped
EDP Manager                                  dread@stripped
Calcasieu Lumber Co.                               Austin TX
-- Meddle not in the affairs of dragons, for you are crunchy
    and taste good with ketchup.

Thread
mySQL Error MessageWilliam Urquhart6 May
  • RE: mySQL Error MessageDon Read6 May