Home  >  Article  >  Backend Development  >  请问生日,性别,地址怎么存储和读取(选择模式!)

请问生日,性别,地址怎么存储和读取(选择模式!)

WBOY
WBOYOriginal
2016-06-13 12:14:141446browse

请教生日,性别,地址如何存储和读取(选择模式!)

本帖最后由 okgef 于 2015-01-21 10:50:11 编辑 比如生日是1990-01-11 怎么在读取的时候自动还原成
性别是:0(保密),保密,男,
地址是:gd755(广东省深圳市)还原为

------解决思路----------------------
1、从数据库取记录
2、将记录结果集赋值给数组
3、写好所有表单项
4、将数组中的值 赋值给表单
------解决思路----------------------
例子:
<br /><?php<br />$conn=mysql_connect('localhost','root','flash') or die('连接服务器失败');<br />$select=mysql_select_db('test',$conn) or die("连接数据库失败");<br />$query = "select * from stu";<br />echo '<select name="sign"> '; <br />if ([email&#160;protected]_query($query)){ <br />$i=0; <br />while([email&#160;protected]_fetch_array($result)) <br />{ <br />echo "<option value='$rows[id]'>$rows[name]</option>"; <br />$i++; <br />} <br />mysql_free_result($result); <br />echo '</select>'; <br />} else echo "执行SQL语句($query)失败:".mysql_error(); <br />?><br />
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn