修改数据表,,我是这样写的,,但是没用,,一打开就自动改了<?
include ("conn.php");
?><html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body>
<script language="JavaScript" type="text/JavaScript">
function ss(){
<?
//修改信息
$sSQL="update user_info set client_ip='211.162.35.249' where user_name ='4b687bb11'";
?>
}
</script>
<form name="form1" method="post" action="">
<div align="center"><input type="button" name="Button" value="Button" onClick="ss()">
</div>
</form>
</body>
</html>
include ("conn.php");
?><html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body>
<script language="JavaScript" type="text/JavaScript">
function ss(){
<?
//修改信息
$sSQL="update user_info set client_ip='211.162.35.249' where user_name ='4b687bb11'";
?>
}
</script>
<form name="form1" method="post" action="">
<div align="center"><input type="button" name="Button" value="Button" onClick="ss()">
</div>
</form>
</body>
</html>
解决方案 »
- ubuntu LAMP下PHP的开发环境zend studio的安装及相关问题
- 肥水不流外人田-时间范围内的限制
- 一个<select>一个text,对数据库进行增删改查
- PHP连接MYSQL有没有经过操作系统
- 请问google.com/search?q=aa方式URL如何实现?
- 一个PHP按拼音分类排序的问题……
- php如何取得多选框群发问题?急!!!
- 求一正则
- asp发送短信功能怎么改成php的,有asp例子,求教
- 哪位大佬知道data下面的值改为动态绑定的,微信官方是这样写的,但是这样写的话值是死的,该学习没多久,请大佬指点一下
- 域名怎样注册解析才能快呢!163,sohu解析都特快。而我注册的一个域名就特慢(在KUWW.NET上注册的),是否在注册的手续、方式上有区别?
- 傻问题(在php5中,怎么打印出一个对象)
function ss(){
<?
//修改信息
$sSQL="update user_info set client_ip='211.162.35.249' where user_name ='4b687bb11'";
$result1=mysql_db_query("sdata",$sSQL,$cn);
?>}
</script>
给你个例子看看,可以达到你的要求。
<input name="sta2" type="button" id="sta2" onClick="sendreceive();" value="send email for received"><iframe id="sendframe" name="sendframe" src="about:blank" width="0" height="0" scrolling="no"></iframe>
<form action="../sendreceive.php" method="post" name="receive" id="receive" target="sendframe">
<input name="r_account" type="hidden" id="r_account" value="">
<input name="r_unit" type="hidden" id="r_unit">
<input name="r_amount" type="hidden" id="r_amount">
<input name="r_email" type="hidden" id="r_email" value="">
<input name="r_status" type="hidden" id="r_status">
<input name="rc_email" type="hidden" id="rc_email">
<input name="receivedate" type="hidden" id="receivedate">
</form>
<script>
function sendreceive()
{
document.all("r_unit").value=document.all("textfield8").value;
document.all("r_amount").value=document.all("textfield9").value;
document.all("r_status").value=document.all("textfield10").value;
document.all("rc_email").value=document.all("textfield11").value;
document.all("receivedate").value=document.all("textfield12").value;
document.all("sta2").value="sending email...";
document.receive.submit();
}
</scrip>
再在sendreceive.php写你的修改数据库语句。
你不给钱也买不到东西啊?
叫“无刷新技术”的。
{
}
这里不会有内容的,当你页面读取后,其实是服务器已经执行了返回的东西。写一个隐藏frame吧。
经典!如果用com,那就应该考虑asp
<?
//修改信息
$sSQL="update user_info set client_ip='211.162.35.249' where user_name ='4b687bb11'";
$result1=mysql_db_query("sdata",$sSQL,$cn);
?>
才将改页发送到客户端,IE才解析function ss(),此时php的sql代码已经执行完了你可这样:
在页面上写一个隐藏表单<form name="form2" target="***.php" style="display:none"></form>
点击按钮后在ss()中提交该隐藏表单document.form["form2"].submit()
然后把数据库操作代码写在***.php中就可以了