Hello,
Can someone view this for me? It submits the first query of:
$query = "INSERT INTO photos (ip, comment, photo)
VALUES ('$ip', '$message', '$path')";
mysql_query($query);
But my 2nd query isn't working:
$query2 = "UPDATE photographys SET last_ip=$ip WHERE name=$path";
mysql_query($query2);
<?php
$path = $_SERVER['PHP_SELF'];
$path_parts = pathinfo($path);
$string = $path_parts["basename"];
$exclude = ".jpg.php";
$path = substr("$string",0,strpos($string,$exclude));
if(isset($_POST['submit'])) {
$ip = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$link = mysql_connect('localhost', 'andrew', '1357908642');
$db_selected = mysql_select_db('andrew_site', $link);
$query = "SELECT last_ip FROM photographys WHERE name=$path";
$result = mysql_query($query);
$extip = mysql_result($result,0);
if ($extip == $ip) {
header("Location: error.php");
}
$message = stripslashes(trim($message));
$message = nl2br($message);
$message = htmlentities($message);
$query = "INSERT INTO photos (ip, comment, photo)
VALUES ('$ip', '$message', '$path')";
mysql_query($query);
$query2 = "UPDATE photographys SET last_ip=$ip WHERE name=$path";
mysql_query($query2);
echo "Thanks $name your comment has been added";
}
?>