RE: [PHP-WIN] Re: MySQL Errors
| From: | David Hamilton | Date: | Thu, 21 Oct 2004 13:59:46 +0000 |
| Subject: | RE: [PHP-WIN] Re: MySQL Errors | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-24793@lists.php.net to get a copy of this message | ||
This might also be of some help.
Change your result and fetch lines to read:
$result = mysql_query($sql,$db) or die (mysql_error());
$myrow=mysql_fetch_array($result) or die(mysql_error());
David
-----Original Message-----
From: Robert Schipper [mailto:froschi82@web.de]
Sent: Thursday, October 21, 2004 7:49 AM
To: php-windows@lists.php.net
Subject: [PHP-WIN] Re: MySQL Errors
hello mikea,
looks like there is something missing in your sourcecode, which you
should have provided. do you give any arguments to
mysql_fetch_array() ? Do you check if it is not false?
your code should look like this:
$sql = "SELECT * FROM example";
$result = mysql_query($sql,$db);
if ($result) {
$myrow=mysql_fetch_array($result);
} else {
echo "ERROR: SQL-query returned false!";
}
Robert
Mikea wrote:
> I am getting the following errors when I execute a php script.
>
> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result
> resource
> Warning: mysql_fetch_row(): supplied argument is not a valid MySQL
result
> resource
> Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result
> resource
>
> What do I need to make this work? I am new to PHP. I read something
about
> mysql.class.php somewhere. Do I need that somewhere? Do I put an
include
> in the main script? Where does mysql.class.php go directory-wise?
>
> I am sure I am not giving enough information and may not be explaining
it
> good enough. My apologies. Again, I am new at this.
>
> I appreciate any help. Thank you in advance.
>
> Mike
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php