html中select语句读取mysql表中


<?
 $record=0;
 
 @mysql_select_db('1234',$db);
 $strsql="select * from 1234_data";
 
 $data=@mysql_fetch_array($result);
 $record=@mysql_num_rows($result);

echo "<select name=type size=1>\n";
do{
if ($record==1){
echo "<option value=".$data['cname']." selected>".$data['cname']."</option>\n";
}
else{
echo "<option value=".$data['cname'].">".$data'cname']."</option>\n";
}
}while($data=@mysql_fetch_array($result));
echo "</select>\n";
?>

本文作者:
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3