Re: Error Msg: Wrong data type when performing "extract()"
| From: | Shahmat Dahlan | Date: | Thu, 19 Apr 2001 06:34:00 +0000 |
| Subject: | Re: Error Msg: Wrong data type when performing "extract()" | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-8692@lists.php.net to get a copy of this message | ||
You're right, no row was returned by the query when i did tried to fetch it. So
I suppose the next viable thing to do is to figure what went wrong with the
query.
Thanks
CC Zona wrote:
> In article <3ADE5038.F47F4701@sains.com.my>,
> shahmatd@sains.com.my ("Shahmat Dahlan") wrote:
>
> > $result=mysql_query($sqlstmt);
> > # print $result;
> > $row=mysql_fetch_array($result)
> >
> > extract($row);
> >
> > If I do the above, I get the results below:
> >
> > Warning: Wrong datatype in call to extract() in
> > E:\winnt\temp\stock_in.php on line 39
> >
> > I've went through the query, and it seems alright. It worked previously,
> > now all of a sudden it doesn't work anymore.. Can anyone help me out.
>
> Since apparently $row is not an array, I'd guess that mysql_fetch_array has
> nothing to fetch (i.e. no row was returned by the query). Two things to
> get into the habit of doing:
>
> 1) check that the query was valid. For example:
> $result=mysql_query($sqlstmt) or die("Query error: " . mysql_error());
>
> 2) check that the query returned 1 or more rows. For example:
> if(mysql_num_rows())
> {
> $row=mysql_fetch_array($result) or die("Row fetching error: " .
> mysql_error()); //BTW, you were missing a semi-colon on this line
> ...
> }
>
> --
> CC
>
> --
> 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