RE: [PHP-DB] Help! Can't "select" db after uploading file from mu lti-part form
| From: | CJ Romberger | Date: | Mon, 19 Jun 2000 20:41:29 +0000 |
| Subject: | RE: [PHP-DB] Help! Can't "select" db after uploading file from mu lti-part form | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-497@lists.php.net to get a copy of this message | ||
Awesome! I didn't get any errors (all zeros), but your reply made me go
find an example of how to use the mysql_error, and I rewrote the code (see
below-non-working code commented out.) Not sure why it works this way and
not the other, but it DOES! If I knew where you were, I'd send you cookies!
:)
Thanx everyone for helping me!
CJ
mysql_connect("localhost", "username", "password");
echo mysql_errno().": ".mysql_error()."<BR>";
mysql_select_db("databasename");
echo mysql_errno().": ".mysql_error()."<BR>";
$conn = mysql_query("SELECT * FROM address_book");
echo mysql_errno().": ".mysql_error()."<BR>";
PREVIOUS CODE COMMENTED OUT
// $connect = mysql_connect("localhost", "username", "password")
|| die
("cannot connect");
// echo mysql_error();
// mysql_select_db($databasename, $connect);
// echo "This is the error :" . mysql_error($connect);
// $sql = "Select * from address_book";
// $result = mysql_query($sql, $connect);
while($myrow = mysql_fetch_array($conn)) {
echo "here is a row<br>";
$id = $myrow["id"];
echo "$id<br>";
}
CJ
"No other personal quality contributes to success more than relentless
persistence in the pursuit of one's goals."
-----Original Message-----
From: Zak Greant [mailto:zak@nucleus.com]
Sent: Monday, June 19, 2000 3:18 PM
To: CJ Romberger; 'Robert Hall'
Cc: 'php-db@lists.php.net'
Subject: RE: [PHP-DB] Help! Can't "select" db after uploading file from
mu lti-part form
At 03:05 PM 6/19/00 -0500, CJ Romberger wrote:
>I know. Rasmus corrected me on that. It doesn't fix anything though. But
>if I either correct this or totally erase the last two lines, I still get
>the error. The error is occurring at the second line.
>
>I appreciate you writing back to this. It has me stumped.
>
>CJ
Hi CJ,
After each mysql_connect and mysql_select_db statement, put a print
mysql_error() statement. This will cause any mysql errors to be printed out.
Ciao,
Zak Greant
Creative Director
Nucleus Information Service Inc.
"I am rather like a mosquito in a nudist camp: I know what I ought to do,
but I don't know where to begin."
- Stephen Bayne
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net