On Saturday 01 February 2003 19:08, Denis L. Menezes wrote:
> Hello friends.
>
> I have a listbox which I populate from a query with the database. It is
> working fine. But additinally, I want the first item to be "Select
> category". Can someone please help me how to modify by below written code
> to do the above?
>
> My code : Quote :
>
>
> <?php
> //connecting to the database
> $link = mysql_connect("localhost","MyDomain","MyPass");
> if ($link){
> Print "";
> } else {
> Print "No connection to the database";
> }
> if (!mysql_select_db("MyDomain_com")){
> Print "Couldn't connect database";
> } else {
> Print ""."<br>\n";
> }
echo "<option ...";
> $sql="SELECT DISTINCT CategoryName From Categories ORDER BY CategoryName";
> $result=mysql_query($sql);
>
> While($Category=mysql_fetch_array($result))
> {
> Print("<OPTION VALUE=\"$Category[0]\">$Category[0]\n");
> }
>
> ?>
>
> Unquote
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
If you are good, you will be assigned all the work. If you are real
good, you will get out of it.
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php