Re: Count
| From: | Pastor Steve | Date: | Thu, 17 Jan 2008 20:01:29 +0000 |
| Subject: | Re: Count | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-267506@lists.php.net to get a copy of this message | ||
Richard,
Thank you so much for your response.
The select would be created from the number of records in the db.
<option value=²$variable²>$variable2</option>
The problem that I am having is rather than getting just the number of
records, which is 3 currently, I would like it to be 1 for the first option,
2 for the second..., so that the user has the choice of any record. The idea
would be to order the content by the highest number.
I hope this makes more sense.
--
Steve M.
on 1/17/08 1:54 PM Richard Heyes (richardh@phpguru.org) wrote:
>> > I am wanting to create an select menu for displaying the order of the item
>> > on a page. I am guessing that I need to get the count of how many items are
>> > in the db and them put them into a select menu.
>
> Your question doesn't really make a great deal of sense. Your SQL could be:
>
> SELECT COUNT(*) FROM your_table WHERE 1
>
> Which will give you a single numeric value back (the number of rows). To
> put them into an HTML page:
>
> <select name="mySelect">
> <option>Choose...</option>
> <option value="1">Foo</option>
> </select>
>
> This is a very basic select. You can simply loop through your query
> results adding more option tags to add more items to the select.