Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need PHP/osCommerce Syntax Help


aldaffodil

Recommended Posts

Posted

Hello everyone! I'm hoping there is someone here who knows how to do this. I need to create some lines of code that will count how many rows total there are in the address_book table. Is there an easy way to do this?

 

Basically, I have a for loop that reads each line of the address book for certain criteria. I need it to know how many lines are in the address book so it knows how many times to go through the loop.

 

Thanks in advance!

Posted

Can't anyone help me with this?

 

This is the best I have come up with:

$address_count_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK);
$address_count = tep_db_fetch_array($count_array);
$count = $address_count['total'];

 

And it produces this error:

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/silkwed/public_html/directory/includes/functions/database.php on line 99

 

What am I doing wrong?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...