Re: Dynamic menu

From: Date: Sun, 21 Jul 2002 05:19:03 +0000
Subject: Re: Dynamic menu
Groups: php.general 
Request: Send a blank email to php-general+get-108701@lists.php.net to get a copy of this message
>Hi all. I’m making a few dynamic menus that grab information from a >MySQL DB. What I don’t know is how to print only one line of each. I >don’t want a Drop Down List displaying 4 times the same line if the >information is repeated in 4 rows in the same table. What I’m using is >something like: > >$query = “SELECT * FROM tbl_name”; >$result = mysql_quiery($query) or die(mysql_error()); >$num_rows = mysql_num_rows($result); > > ><select name="select_name"> ><option SELECTED>Select Something</option> > >for ($i=0; $i<$num_rows: $i++) >{ >$row = mysql_fetch_array($result); >print ("<option >value=\"".$row[some]."\">".$row[some_else]."</option>"); >} > ></select> > >This works just fine now that I don’t have 2 or more rows with the >“some_else” repeated. Is there a WHERE or something like that which I >can use for this? I think you want SELECT DISTINCT * http://mysql.com/ -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#108701) next »