php insert doesnot take place _ URGENT HELP PLEASE
Posted
by reggie
on Stack Overflow
See other posts from Stack Overflow
or by reggie
Published on 2010-04-23T13:34:01Z
Indexed on
2010/04/23
14:13 UTC
Read the original article
Hit count: 250
my code is as follows
<?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;
}
?>
My problem is that the insert process doesnot take place at all. the script tags echos an alert box. even the img tag is echoed to the web page. but the insert process doesnot take place. the config file is fine.. note: this code works on my local machine which has php 5.3 but it doesnot work on the server which has php 5.2.. any advice..???
© Stack Overflow or respective owner