Mysql的问题,急! 错误提示是什么呀?你说的这种情况还是第一次遇见.你的insert语句中是否包含别的数据库操作的?比如通过查询记录+1来确定此次插入记录的ID什么的. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 function save_ip($ipadd){$ip=$ipadd;$t=getdate();$db=mysql_connect($serverhost,$loginmysqluser,$loginmysqlpassword);mysql_select_db("datasql",$db);$sql ="select * from ipaddress";$row=mysql_query($sql,$db);while($r=mysql_fetch_array($row)){ if($r["ipdizhi"]!=$ip) {$nottrue="on";} else{$nottrue="off";} echo $nottrue;}echo $nottrue;if ($nottrue=="on"){$sql1="INSERT INTO ipaddress ( ipdizhi , shijian ) VALUES ( '$ip' , '".$_SESSION['now']."' )";$query1=mysql_query($sql1,$db);mysql_close($db);}} $row=mysql_query($sql,$db);while($r=mysql_fetch_array($row)){ if($r["ipdizhi"]!=$ip) {$nottrue="on";} else{$nottrue="off";} echo $nottrue;}修改为:if($row = mysql_query($sql, $db)) { //这里加一个判断,如果有记录得话,执行下面得 while($r = mysql_fetch_array($row)) { if($r["ipdizhi"] != $ip) { $nottrue = "on"; } else { $nottrue = "off"; } }} else { //没有任何记录得话 $nottrue = "on";} echo $nottrue;另外给你得建议是:希望你得编码写得规范一点! php+mysql 中文显示变成了问号~~ 帮忙写个php 关于打印问题,PHP结合Java! 怎样还原显示包含进来的txt或者无后缀的文件? 幫幫忙。PHP 如何連接 SQLSERVER 这个分页如何写啊?? 这个问题谁能帮我解决一下,先谢了! 请教PHP 4.0中有没有能定位到某一个网页的函数? 类似与ASP中的redirect.先谢过! 在PHP中用什么方法可以替代ASP中的Application? php基础 ||问题 php js sql 计数器代码?
$ip=$ipadd;
$t=getdate();
$db=mysql_connect($serverhost,$loginmysqluser,$loginmysqlpassword);
mysql_select_db("datasql",$db);
$sql ="select * from ipaddress";
$row=mysql_query($sql,$db);
while($r=mysql_fetch_array($row)){
if($r["ipdizhi"]!=$ip)
{$nottrue="on";}
else{$nottrue="off";}
echo $nottrue;}
echo $nottrue;
if ($nottrue=="on"){
$sql1="INSERT INTO ipaddress ( ipdizhi , shijian ) VALUES ( '$ip' , '".$_SESSION['now']."' )";
$query1=mysql_query($sql1,$db);
mysql_close($db);}}
while($r=mysql_fetch_array($row)){
if($r["ipdizhi"]!=$ip)
{$nottrue="on";}
else{$nottrue="off";}
echo $nottrue;}修改为:if($row = mysql_query($sql, $db)) { //这里加一个判断,如果有记录得话,执行下面得
while($r = mysql_fetch_array($row)) {
if($r["ipdizhi"] != $ip) {
$nottrue = "on";
} else {
$nottrue = "off";
}
}
} else { //没有任何记录得话
$nottrue = "on";
}
echo $nottrue;另外给你得建议是:希望你得编码写得规范一点!