Jump to content

Do you know PDO, translate something form me


Lodius2000

Recommended Posts

Hi im looking in a book that uses PDO, I think I can adapt the script to not use PDO, but i need to know what exactly this line would return so that I can adapt it to my needs

 

$total = $db->query('SELECT COUNT(*) FROM table_name')->fetchColumn(0);

 

that being say the table's column 0, (which is the first column, right) is an INT field called id with unique ids starting a 1 and going to 100, 1 id per row

 

could i access the same info with

 

$db = mysql_numrows('SELECT id FROM table_name');

 

in both cases the query would return 100 right?

corbin, I guess I dont understand your first reposne then

 

looking further down the script $total is refernced this way

 

print "(Displaying $offset - $lastrownumber of $total)";

 

this would print something like (going with my 100 rowed example)

 

(Displaying 1-5 of 100) 

or 5-10 of 100 or 11-15 of 100 depending on what page you were viewing

 

I am making paginated links for my blog

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.