我的代碼如下:數據庫插入不會發生
<?php
include("config.php");
$ip=$_SERVER['REMOTE_ADDR'];
if($_POST['id'])
{
$id=$_POST['id'];
$id = mysql_escape_String($id);
$ip_sql=mysql_query("select ip_add from Voting_IP where mes_id_fk='$id' and ip_add='$ip'");
$count=mysql_num_rows($ip_sql);
if($count==0)
{
$sql = "update Messages set up=up+1 where mes_id='$id'";
mysql_query($sql);
$sql_in = "insert into Voting_IP (mes_id_fk,ip_add) values ('$id','$ip')";
mysql_query($sql_in) or die(mysql_error());
echo "<script>alert('Thanks for the vote');</script>";
}
else
{
echo "<script>alert('You have already voted');</script>";
}
$result=mysql_query("select up from Messages where mes_id='$id'");
$row=mysql_fetch_array($result);
$up_value=$row['up'];
echo "<img src='button.png' width='110' height='90'>";
echo $up_value;
}
?>
我的問題是,在插入過程中不會發生的。 script
標籤回顯一個警告框。即使是img
標籤也會回傳到網頁上。但插入過程不會發生。配置文件很好。 注意:此代碼適用於具有PHP 5.3的本地計算機,但不適用於具有PHP 5.2的服務器。
愚蠢的問題,但你成功地連接到在這兩種情況下的分貝?該代碼未在此顯示。 – Tom 2010-04-23 13:49:50
是的,我成功了..再次,代碼在我的本地服務器上正常工作..但沒有在我的wwebserver上工作 – reggie 2010-04-23 13:57:29
但是,你看到數據庫中的新值嗎? – mck89 2010-04-23 14:00:44