Re: [PHP-DB] newbie having problem
Oops, I forgot to say that I can handle this db as a client on the command line and it shows up under mysqlshow. George - Original Message - From: George Pitcher <[EMAIL PROTECTED]> To: Jason Wong <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, September 05, 2001 7:46 AM Subject: Re: [PHP-DB] newbie having problem > Jason, > > Having tried your suggestion, I see that I can connect to the server but > cannot select the db. > > Where do I go from here? > > George > - Original Message - > From: Jason Wong <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, September 03, 2001 4:39 PM > Subject: Re: [PHP-DB] newbie having problem > > > > > > - Original Message - > > From: George Pitcher <[EMAIL PROTECTED]> > > To: Torgil Zechel <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Monday, September 03, 2001 11:19 PM > > Subject: Re: [PHP-DB] newbie having problem > > > > > > > > if( $result == FALSE ) > > > > { > > > > echo mysql_error(); > > > > } > > > Yes - progress - its telling me that no database was selected. > > > > > > My code again: > > > > > > > > > mysql_connect ('pingu','root@localhost',''); > > > > > mysql_select_db ('Bizplanes'); > > > > > if ($Serial == "") > > > > > {$Serial = '%';} > > > > > if ($Type == "") > > > > > {$Type = '%';} > > > > > if ($Con == "") > > > > > {$Con = '%';} > > > > > $result=mysql_query ("SELECT * FROM biz WHERE > > > > > ID LIKE '%$Serial%' AND > > > > > Type LIKE '%$Type%' > > > > > Con LIKE '%$Con%' > > > > > ORDER BY ID"); > > > > > ?> > > > > You haven't specified a password when connecting to the server -- does it > > require one? > > > > Have you tried the code as per manual: > > > > $link = mysql_connect("mysql_host", "mysql_login", "mysql_password") > > or die ("Could not connect"); > > print ("Connected successfully"); > > mysql_select_db ("my_database") > > or die ("Could not select database"); > > > > to ensure that you *are* able to connect to the server and also *select* > the > > database? > > > > hth > > -- > > Jason Wong > > Gremlins Associates > > www.gremlins.com.hk > > Tel: +852-2573-5033 > > Fax: +852-2573-5851 > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > _ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] newbie having problem
Jason, Having tried your suggestion, I see that I can connect to the server but cannot select the db. Where do I go from here? George - Original Message - From: Jason Wong <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, September 03, 2001 4:39 PM Subject: Re: [PHP-DB] newbie having problem > > - Original Message - > From: George Pitcher <[EMAIL PROTECTED]> > To: Torgil Zechel <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Monday, September 03, 2001 11:19 PM > Subject: Re: [PHP-DB] newbie having problem > > > > > if( $result == FALSE ) > > > { > > > echo mysql_error(); > > > } > > Yes - progress - its telling me that no database was selected. > > > > My code again: > > > > > > > mysql_connect ('pingu','root@localhost',''); > > > > mysql_select_db ('Bizplanes'); > > > > if ($Serial == "") > > > > {$Serial = '%';} > > > > if ($Type == "") > > > > {$Type = '%';} > > > > if ($Con == "") > > > > {$Con = '%';} > > > > $result=mysql_query ("SELECT * FROM biz WHERE > > > > ID LIKE '%$Serial%' AND > > > > Type LIKE '%$Type%' > > > > Con LIKE '%$Con%' > > > > ORDER BY ID"); > > > > ?> > > You haven't specified a password when connecting to the server -- does it > require one? > > Have you tried the code as per manual: > > $link = mysql_connect("mysql_host", "mysql_login", "mysql_password") > or die ("Could not connect"); > print ("Connected successfully"); > mysql_select_db ("my_database") > or die ("Could not select database"); > > to ensure that you *are* able to connect to the server and also *select* the > database? > > hth > -- > Jason Wong > Gremlins Associates > www.gremlins.com.hk > Tel: +852-2573-5033 > Fax: +852-2573-5851 > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] newbie having problem
- Original Message - From: George Pitcher <[EMAIL PROTECTED]> To: Torgil Zechel <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, September 03, 2001 11:19 PM Subject: Re: [PHP-DB] newbie having problem > > if( $result == FALSE ) > > { > > echo mysql_error(); > > } > Yes - progress - its telling me that no database was selected. > > My code again: > > > > > mysql_connect ('pingu','root@localhost',''); > > > mysql_select_db ('Bizplanes'); > > > if ($Serial == "") > > > {$Serial = '%';} > > > if ($Type == "") > > > {$Type = '%';} > > > if ($Con == "") > > > {$Con = '%';} > > > $result=mysql_query ("SELECT * FROM biz WHERE > > > ID LIKE '%$Serial%' AND > > > Type LIKE '%$Type%' > > > Con LIKE '%$Con%' > > > ORDER BY ID"); > > > ?> You haven't specified a password when connecting to the server -- does it require one? Have you tried the code as per manual: $link = mysql_connect("mysql_host", "mysql_login", "mysql_password") or die ("Could not connect"); print ("Connected successfully"); mysql_select_db ("my_database") or die ("Could not select database"); to ensure that you *are* able to connect to the server and also *select* the database? hth -- Jason Wong Gremlins Associates www.gremlins.com.hk Tel: +852-2573-5033 Fax: +852-2573-5851 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] newbie having problem
> if( $result == FALSE ) > { > echo mysql_error(); > } Yes - progress - its telling me that no database was selected. My code again: > > > mysql_connect ('pingu','root@localhost',''); > > mysql_select_db ('Bizplanes'); > > if ($Serial == "") > > {$Serial = '%';} > > if ($Type == "") > > {$Type = '%';} > > if ($Con == "") > > {$Con = '%';} > > $result=mysql_query ("SELECT * FROM biz WHERE > > ID LIKE '%$Serial%' AND > > Type LIKE '%$Type%' > > Con LIKE '%$Con%' > > ORDER BY ID"); > > ?> > > > > TABLE STUFF HERE Regards George Pitcher Technical Manager HERON Project Napier University Edinburgh EH10 5DT [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.heron.ac.uk programmer - A device for transmuting caffeine into code. _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] newbie having problem
I did this directly into MySQL on the LinuxPPC box: mysql> select * from biz where -> ID LIKE '%AXD%' AND -> Type LIKE '%' AND -> Con LIKE '%' -> ORDER BY ID; and this is the response: ++-+-+--+-+---+ | ID | Type| Con | Operator | History | Notes | ++-+-+--+-+---+ |DC | Piper Aztec | 27-4169 | | G-AXDC | |DL | Piper Twin Comanche | 30-1856 | | G-AXDL | |DM | BAE HS 125/400B | 25194 | | G-AXDM | ++-+-+--+-+---+ In these records, what is actually in the ID field is also being displayed in 'History'. Not sure if this clarifies things? George - Original Message - From: Torgil Zechel <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, September 03, 2001 11:38 AM Subject: SV: [PHP-DB] newbie having problem > Check if mysql_query returns false. If it does (and im pretty sure it do), > use mysql_error to check whats wrong... (Another way is to echo the query > and paste it into the mysql command line client..) > > $result = mysql_query("..."); > > if( $result == FALSE ) > { > echo mysql_error(); > } > > > I'm doing some basic php/MySQL stuff (LinuxPPC on Mac7100). I'm > > gettin g the > > following error when I search for somthing. > > > > Supplied argument is not a valid MySQL result resource in > > /usr/local/apache/htdocs/bizflyer/Bizflyer_R1.php on line 32 > > > > Here's my relevant code: > > > > > mysql_connect ('pingu','root@localhost',''); > > mysql_select_db ('Bizplanes'); > > if ($Serial == "") > > {$Serial = '%';} > > if ($Type == "") > > {$Type = '%';} > > if ($Con == "") > > {$Con = '%';} > > $result=mysql_query ("SELECT * FROM biz WHERE > > ID LIKE '%$Serial%' AND > > Type LIKE '%$Type%' > > Con LIKE '%$Con%' > > ORDER BY ID"); > > ?> > > > > TABLE STUFF HERE > > > > > if ($row=mysql_fetch_array($result)) { # this is line 32 > > do { > > print (""); > > print $row['ID']; > > print (""); > > print $row['Type']; > > print (""); > > print $row['Con']; > > print (""); > > print $row['Operator']; > > print (""); > > } while ($row=mysql_fetch_array($result)); > > } else {print ("Sorry, no aircraft matching your criteria were found.");} > > ?> > > = > > > > Any suggestions as to where I'm going wrong? > > > > > > Regards > > > > George Pitcher > > > > Technical Manager > > HERON Project > > Napier University > > Edinburgh EH10 5DT > > > > [EMAIL PROTECTED] > > [EMAIL PROTECTED] > > [EMAIL PROTECTED] > > > > http://www.heron.ac.uk > > > >programmer - A device for transmuting caffeine into code. > > > > > > > > > > _ > > Do You Yahoo!? > > Get your free @yahoo.com address at http://mail.yahoo.com > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED]