嗨,我对 php 和 slq 编码非常陌生.. 我一直在寻找和处理一切以便能够更新我的 php 数据库..
这是我编写得如此公平的内容.. 这在论坛中显示了我的数据库的字段
<?php
$host="localhost"; // Host name
$username="mixfm_djs"; // Mysql username
$password="0121do1"; // Mysql password
$db_name="mixfm_djs"; // Database name
$tbl_name="table1"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
?>
<form id="form1" name="form1" method="post" action="index.php">
<table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<td><form name="form1" method="post" action="update_ac.php"></td>
</tr>
<tr>
<td><table width="400" border="1" cellspacing="0" cellpadding="3">
<tr>
<td colspan="4"><strong>List data from mysql </strong></td>
</tr>
<tr>
<td align="center"><strong>DJ-Name</strong></td>
<td align="center"><strong>Password</strong></td>
<td align="center"><strong>State</strong></td>
<td align="center"> </td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td><input name="djname" type="text" id="djname" value="<? echo $rows['djname']; ?>" /></td>
<td><input name="name" type="text" id="name" value="<? echo $rows['name']; ?>" size="15" /></td>
<td><input name="state" type="text" id="state" value="<? echo $rows['state']; ?>" size="15" /></td>
<td align="center"> </td>
</tr>
<?php
}
?>
</table></td>
</tr>
</table>
<p>
<input type="submit" name="update" id="update" value="update" />
</p>
<?php
mysql_close();
?>
</form>
希望有人可以帮助
谢谢