mysql/php count rows

Status
Not open for further replies.

conor

New Member
i have this table:

+---------+------------+
| page_id | url |
+---------+------------+
| 1 | page_1.php |
+---------+------------+
| 2 | page_2.php |
+---------+------------+
| 3 | page_3.php |
+---------+------------+

I want to create a php counter that gets the number of rows in the page_id field, adds them together and then adds one to the answer.

ie. from the table above it would count the rows and come out with 3. then it would add one to it and return the answer of 4.

something like:
$page_id_counter = 0;

then get the code to count the rows. and then:

$page_id_counter = $page_id_counter + 1;

Can anybody suggest a way of doing this? Or alternatively a better method of doing the same sort of thing?
 
Status
Not open for further replies.
Top