Bluehost.com Web Hosting $6.95

RE: [PHP] newbY prob

This is a discussion on RE: [PHP] newbY prob within the PHP General forums, part of the PHP Programming Forums category; > ! am trying to count the number of items in this table. The table > has one field in it. &...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-23-2003
Jennifer Goodie
 
Posts: n/a
Default RE: [PHP] newbY prob


> ! am trying to count the number of items in this table. The table
> has one field in it.
>
> The code I am using is:
>
> $dbquerymeal = "select COUNT(*) from mealtype";
> $resultmeal = mysql_db_query($dbname,$dbqueryshipping1);
> if(mysql_error()!=""){echo mysql_error();}
> $mealcount = mysql_fetch_row($resultmeal);
> echo $mealcount;
>
> The result I am getting is:
>
> Query was empty
> Warning: mysql_fetch_row(): supplied argument is not a valid
> MySQL result resource in search.php
>
> Any suggestions?


Where is $dbqueryshipping1 set? I see $bdquerymeal, but not
$dbqueryshipping1.

Reply With Quote
  #2 (permalink)  
Old 07-23-2003
Cpt John W. Holmes
 
Posts: n/a
Default Re: [PHP] newbY prob

From: "Jennifer Goodie" <goodie@apollointeractive.com>
> > ! am trying to count the number of items in this table. The table
> > has one field in it.
> >
> > The code I am using is:
> >
> > $dbquerymeal = "select COUNT(*) from mealtype";
> > $resultmeal = mysql_db_query($dbname,$dbqueryshipping1);
> > if(mysql_error()!=""){echo mysql_error();}
> > $mealcount = mysql_fetch_row($resultmeal);
> > echo $mealcount;
> >
> > The result I am getting is:
> >
> > Query was empty
> > Warning: mysql_fetch_row(): supplied argument is not a valid
> > MySQL result resource in search.php
> >
> > Any suggestions?

>
> Where is $dbqueryshipping1 set? I see $bdquerymeal, but not
> $dbqueryshipping1.


Also, once you fix that, $mealcount is going to be an array. You need to
display $mealcount[0] to get the value.

---John Holmes...

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:08 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0