RE: [PHP] Count function. (Newbie Question)
| From: | Dell Coleman | Date: | Mon, 09 Apr 2001 17:30:58 +0000 |
| Subject: | RE: [PHP] Count function. (Newbie Question) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-47838@lists.php.net to get a copy of this message | ||
No, this is different - try
$query = "SELECT id,count(*) as result_count FROM mango_pr";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$id=$row['id'];
$result_count=$row['result_count'];
echo "$id,$result_count";
You might need to make the form action=$PHP_SELF if you want the form to
loop
Also you can use a progream structure like
if ($submit) {
// validate and update new stuff
}
else
{
// display the form action=$PHP_SELF
}
to display and validate the form
-----Original Message-----
From: Michael O'Neal [mailto:mike@thinkmango.com]
Sent: Monday, April 09, 2001 9:53 AM
To: php-general@lists.php.net
Subject: RE: [PHP] Count function. (Newbie Question)
>Hi
>
>There are 2 issues:
>
>You need to maintain a page counter
>
>You need to pass the page counter and the total page count from page to
page
>
>You can do this via url params
>(xxx.html?page=$page_count&record_count=$record_count), sessions or cookies
>depending
>
>HTH
Let me elaborate a little bit more. I don't think I explained myself
very well. Sorry to waste the bandwidth.
I am building a little press-release administration for our sales
department. There is a single page that contains form fields where they
can input thier data. I want the users/admins to be able to see what
record number they are editing, and how many total records there are in
the db. I have figured out the record number by echoing the "ID" of the
record. I can't figure out how to display how many *total* records there
are in that db. Does your tip still apply?
Thanks again,
mto
Michael O'Neal
Web Producer/ Autocrosser
ST 28 '89 Civic Si
---------------------
M A N G O
B O U L D E R
---------------------
http://www.thinkmango.com
e-mike@thinkmango.com
p-303.442.1821
f-303.938.8507
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net