Hi Can someone please tell me what is the mistake in the syntax on line 5 I'm doing in the code below:
<?php
$imageID = $_REQUEST["id"]; //get the images ID from the url (e.g rate.php?id=1)
$rating = $_POST["rating"]; //get the rating which was posted from the form
$ip = $_SERVER['REMOTE_ADDR]; //get the ip of the user
$checkIPQuery = mysql_query("SELECT * FROM ratings WHERE imageID = '$imageID' and ip = '$ip' "); //select all the ratings where the image id is the same as this one and
the same IP is used
$doesIPExist = mysql_num_rows($checkIPQuery); //check how many results match the query above
if($doesIPExist == 0){ //if no results exist
mysql_query("INSERT INTO ratings (imageID, rating, ip) VALUES ('$imageID', '$rating', '$ip')"); //save the rating to the database
echo 'Thanks for the rating!'; //and say thanks!
}else{ //if the ip and image are already present in the database
echo 'You have already rated this image!'; //tell the user they cannot rate this image again!
}
?>
Im getting this error:
Parse error: syntax error, unexpected T_VARIABLE, expecting ']' in D:\Hosting\7520570\html\india\rate.php on line 5
Thanks in advance.