todayme Posted March 14, 2007 Share Posted March 14, 2007 See below between //------------ I have written an explination, I have tried and tried to do this can someone please help. ?> <select name="Location"> <?php $query=mysql_query("SELECT $dbState FROM $locationtype"); while ($fetch=mysql_fetch_assoc($query)) { //----------------------------------------------------------------- Select from table where Industry = $dbIndustry and Location1 = $dbState If one or more records exists put the value of the first query into the drop down box if not dont do it //----------------------------------------------------------------- echo '<option value="'.$fetch[$dbState].'">'.$fetch[$dbState].'</option>'; } mysql_close($db);?></select> Link to comment https://forums.phpfreaks.com/topic/42642-someone-with-some-talent-please-help/ Share on other sites More sharing options...
todayme Posted March 14, 2007 Author Share Posted March 14, 2007 Also the the query in the //------------ is to a different table to the first one outside the //-------- Link to comment https://forums.phpfreaks.com/topic/42642-someone-with-some-talent-please-help/#findComment-206896 Share on other sites More sharing options...
monk.e.boy Posted March 14, 2007 Share Posted March 14, 2007 $sql=mysql_query("SELECT $dbState FROM $locationtype"); if ($row=mysql_fetch_assoc($sql)) { echo 'one value found : '. $row[0]; } else { echo 'None found.'; } This is a neat little trick to grab the top row. monk.e.boy Link to comment https://forums.phpfreaks.com/topic/42642-someone-with-some-talent-please-help/#findComment-206983 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.