Re: question on listbox.

From: Date: Sat, 01 Feb 2003 12:21:30 +0000
Subject: Re: question on listbox.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-133865@lists.php.net to get a copy of this message
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. */

« previous php.general (#133865) next »