我有一个类似html的控件.
I have a control in html look like this.
<select name='diet' class='inputbox'> <option value=''>Select one</option> <option value='VEG' >VEG</option> <option value='Non-Veg' >Non-Veg</option> <option value='Eggiterian' >Eggiterian</option> </select>现在通过PHP将数据存储在MYSQL中. 现在在检索时,我执行一个查询. 像这样
Now through PHP I stored the data in MYSQL. Now at the time of retrieve, I execute a query. Like this
$qry="SELECT diet FROM tablename where id=" .$id ; $res=mysql_query($qry); while($val = mysql_fetch_array($res)) { //please help me here to select the above control's value }数据库只能存储VEG,非VEG或Eggiterian值. 在检索过程中,应选择查询结果中存在的值. 请帮帮我. 我想通过查询结果的值选择组合框的值.
Database can store only VEG, non-VEG, or Eggiterian value. at the time of retrieval process it should select the value present in the query result. Please help me. I want to select the value of the combo box by the value of my query result.
$qry="SELECT diet FROM tablename where id=" .$id ; $res=mysql_query($qry); while($val = mysql_fetch_array($res)) { echo " <select name='diet' class='inputbox'> <option value=''>Select one</option> <option value='VEG' >VEG</option> <option value='Non-Veg' >Non-Veg</option> <option value='Eggiterian' >Eggiterian</option> </select>"; }我需要使用数据库表中存在的值选择组合框选项.值将是素食者,非素食者或蛋鸡.请帮助
I need to select the option of combo box with the value present in my database table. Value will be either veg or non-veg or eggiterian. please help
推荐答案qry = " 从表名中选择节食其中id =".
id;
res = mysql_query( res=mysql_query(
更多推荐
PHP代码以选择HTML中的select控件的值
发布评论