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";
 }

$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

Thanks very much

Denis

Reply via email to