高手帮忙看看PHP更新问题 本帖最后由 haihao_110 于 2010-08-03 10:12:44 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 upedit.php?hid=……这个链接点过去,只能取到 $_GET['hid'];的值其他的不在超链接里,不能取到值的。你要单独写一个编辑页面。首先根据 $_GET['hid']把需要修改的数据取出来,通常放在页面表单form里然后让用户输入修改,再提交表单。服务器接收数据,修改 <a href="up_load.php?hid=' . $row['h_id'] . '">编辑</a>点击编辑按钮后,不能传递值啊$db_host="127.0.0.1:3306";$db_user="root";$db_psw="";$db_name="mysql";$connection=mysql_connect($db_host,$db_user,$db_psw)or die("连接服务器失败");mysql_select_db($db_name,$connection)or die("选择数据库失败");//从数据库里去数据 $hid = !empty($_GET['hid'])?intval($_GET['hid']):0;$hotel_id=$_GET['hotel_id'];$start_date=$_GET['start_date']; $end_date=$_GET['end_date']; $content=$_GET['content']; $source=$_GET['source']; $s_type=$_GET['s_type']; $MySql_update=mysql_query("update hotel_activities_2 set hotel_id='$hotel_id',start_date='$start_date',end_date='$end_date',content='$content',source='$source',s_type='$s_type' where h_id='$hid"); $result=mysql_query($MySql_update); echo mysql_errno(); if ($result) { echo '数据更新成功!'; }else { echo '数据更新失败!'; } 大侠们帮帮忙 <form action="upedit.php" method="get"><table border=1 height=100 width=400 align="center"> <tr> <td>hotel_id: </td> <td> <input name="hotel_id" type="text" value='$rows[hotel_id]' size=45 /> </td> </tr> <tr> <td>start_date: </td> <td> <input name="start_date" type="text" value='$rows[start_date]'size=45> </td> </tr> <tr> <td>end_date: </td> <td> <input name="end_date" type="text" value='$rows[end_date]'size=45> </td> </tr> <tr> <td>content: </td> <td> <input name="animal" type="text" value='$rows[news_date]'size=45> </td> </tr> <tr> <td>source: </td>"; <td> <input name="source" type="text" value='$rows[source]'size=45> </td> </tr> <tr> <td>s_type:</td> <td> <input name="s_type" type="text" value="$rows[s_type]"> </td> </tr> <tr> <td> </td> <td> <input name="submit" type="submit" value="用户更新"> <input name="fanhui" type="button" value="返回" onClick="window.open ('index_baocun.php')"></td></tr></table></form> 有谁用过这个free-web-host的免费空间吗?我怎么建不了网站? 7K报酬,找人帮忙做一套B/S的系统,功能不是很复杂 php高手可以帮帮我吗?偶是个新手,非常感谢啊 编程资料哪里找 使用pdo连接数据sqlite数据库 遇到个问题,关于中文站英文站切换不重新登陆的 自己写的php,asp,aspx商业免费的? (别处提问,50分等着您)急!!!在线等!解决就结贴!php url 传值问题 nginx 配置thinkphp wamp安装后phpmyadmin找不到应用程序? php如何进行数据绑定 PHP 怎么做XP下的新建,加载计划任务程序
你要单独写一个编辑页面。首先根据 $_GET['hid']把需要修改的数据取出来,通常放在页面表单form里然后让用户输入修改,再提交表单。服务器接收数据,修改
点击编辑按钮后,不能传递值啊
$db_host="127.0.0.1:3306";
$db_user="root";
$db_psw="";
$db_name="mysql";
$connection=mysql_connect($db_host,$db_user,$db_psw)or die("连接服务器失败");
mysql_select_db($db_name,$connection)or die("选择数据库失败");
//从数据库里去数据
$hid = !empty($_GET['hid'])?intval($_GET['hid']):0;
$hotel_id=$_GET['hotel_id'];
$start_date=$_GET['start_date'];
$end_date=$_GET['end_date'];
$content=$_GET['content'];
$source=$_GET['source'];
$s_type=$_GET['s_type'];
$MySql_update=mysql_query("update hotel_activities_2 set hotel_id='$hotel_id',start_date='$start_date',end_date='$end_date',content='$content',source='$source',s_type='$s_type' where h_id='$hid");
$result=mysql_query($MySql_update);
echo mysql_errno();
if ($result) {
echo '数据更新成功!';
}else {
echo '数据更新失败!';
}
大侠们帮帮忙
<table border=1 height=100 width=400 align="center">
<tr>
<td>hotel_id: </td>
<td> <input name="hotel_id" type="text" value='$rows[hotel_id]' size=45 /> </td>
</tr>
<tr>
<td>start_date: </td>
<td> <input name="start_date" type="text" value='$rows[start_date]'size=45> </td>
</tr>
<tr>
<td>end_date: </td>
<td> <input name="end_date" type="text" value='$rows[end_date]'size=45> </td>
</tr>
<tr>
<td>content: </td>
<td> <input name="animal" type="text" value='$rows[news_date]'size=45> </td>
</tr>
<tr>
<td>source: </td>";
<td> <input name="source" type="text" value='$rows[source]'size=45> </td>
</tr>
<tr>
<td>s_type:</td>
<td> <input name="s_type" type="text" value="$rows[s_type]"> </td>
</tr>
<tr>
<td> </td>
<td> <input name="submit" type="submit" value="用户更新"> <input name="fanhui" type="button" value="返回" onClick="window.open ('index_baocun.php')"></td>
</tr></table>
</form>