RE: Re: MySQL Errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx] 
Sent: Thursday, October 21, 2004 7:49 AM
To: php-windows@xxxxxxxxxxxxx
Subject:  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

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux