Forums / General Questions / Display number of pending orders on main site

Display number of pending orders on main site

Started by abcisme on 17 Feb 2015, 3:16 PM · Views: 566

Results 1 to 3 of 3
17 Feb 2015, 3:16 PM
#1
abcisme avatar

abcisme

Zen Follower

Join Date:
Jun 2006
Posts:
298
Plugin Contributions:
0

Display number of pending orders on main site

I would like to be able to display for our customers how many orders we currently have in our processing queue. I tried the following query, but I must have something wrong. I can't determine why it's not showing the count. Can anyone help me sort this?

$query = "select count(*) as count from " . TABLE_ORDERS . " where orders_status = '114'"; 
$result = mysql_query($query); 
$values = mysql_fetch_assoc($result); 
$num_rows = $values['total']; 
echo $num_rows;
17 Feb 2015, 3:51 PM
#2
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Display number of pending orders on main site

abcisme:

I would like to be able to display for our customers how many orders we currently have in our processing queue. I tried the following query, but I must have something wrong. I can't determine why it's not showing the count. Can anyone help me sort this?

Try this:

$query = "select * from " . TABLE_ORDERS . " where orders_status = '114'"; 
              $result = mysql_query($query);
               $count = mysql_num_rows($result) ;
echo $count ; 

or this

 $query = "select * from " . TABLE_ORDERS . " where orders_status = '114'"; 
$num_rows_result = $db->Execute($query);
$num_rows = $num_rows_result->RecordCount();

Cheers
RodG

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

17 Feb 2015, 8:19 PM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,120
Plugin Contributions:
56

Re: Display number of pending orders on main site

RodG:

Try this:

$query = "select * from " . TABLE_ORDERS . " where orders_status = '114'";
$result = mysql_query($query);
$count = mysql_num_rows($result) ;
echo $count ;

> 
> or this 
> ```
 $query = "select * from " . TABLE_ORDERS . " where orders_status = '114'"; 
$num_rows_result = $db->Execute($query);
$num_rows = $num_rows_result->RecordCount();

Cheers
RodG
Definitely use the latter suggestion ($db->Execute) or your customization won't work with PHP 5.5 and later (when the mysql_* functions are deprecated, i.e. no longer included).