Re: help on something simple?
| From: | Plutarck | Date: | Sat, 14 Apr 2001 15:09:31 +0000 |
| Subject: | Re: help on something simple? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-48552@lists.php.net to get a copy of this message | ||
What function are you calling on $result when it returns the error?
Try doing this, all in one place:
$db = mysql_connect("localhost", "username");
mysql_select_db("subsurface_net", $db);
$result = mysql_query("SELECT * FROM customer_genre", $db);
echo mysql_num_rows($result);
When you use a SELECT query the function "mysql_affected_rows" is not valid.
When using an UPDATE, INSERT, or DELETE query, "mysql_num_rows" is invalid.
That may be your problem, because the code you paste in seems not to have
anything wrong with it.
--
Plutarck
Should be working on something...
...but forgot what it was.
""Andrew Durk"" <adurk@aics.net> wrote in message
news:9b9n47$7ej$1@toye.p.sourceforge.net...
> I can get connected to my host's MySQL database w/o error, but I cannot
seem
> to do anything after that.
>
> I do:
> $db = mysql_connect("localhost", "username");
> mysql_select_db("subsurface_net",$db);
>
> No problem, but if I do this:
> $result = mysql_query("SELECT * FROM customer_genre",$db);
>
> I eventually get:
> Warning: 0 is not a MySQL result index in /test.phtml on line 35
>
> And customer_genre _is_ a table in my database...
>
> Help, anyone!?
> --
> Andrew Durk
> adurk@aics.net
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>