Another problem then once I’ve solved this… I have finished my little project thing. I was wondering if there is anyway I can kind of step-through a php script and find out where the error happens?? Yet again this shows as nothing but this time it doesn’t appear to be a missing semi-colon etc. I used to do some programming when I was younger and I remember the majority of silly errors of the kind I am making with this php were easily picked up by the compiler which made life a lot easier…
Here’s the problem code and I wouldn’t mind if anyone does spot the problem(s) but also being pointed in the direction so I can solve them myself now and/or in the future would be appreciated.
Cheers.
[code]<?php
//connection
include(“connect.php”);
//create header escape string thing
$returntoform = “Location: add_review.php?id=” . $_POST[“venue_id”];
if(isset($_POST[“submit”]) {
if(empty($_POST["email"]) || empty($_POST["password"]) ||
empty($_POST["title"]) || empty($_POST["body"])) {
echo "Form not completed.";
header($returntoform);
exit;
}
//check user details
$email = $_POST["email"];
$password = $_POST["password"];
$sql = "SELECT user_id, password FROM user WHERE email='$email'";
$result = mysql_query($sql);
if(!$result) {
echo "email address not found!";
header($returntoform);
exit;
}
$user = mysql_fetch_object($result);
if($user->password != $password) {
echo "Password incorrect!";
header($returntoform);
exit;
}
$user_id = $user->user_id;
$title = $_POST["title"];
$body = $_POST["body"];
$venue_id = $_POST["venue_id"];
//email and password, OK. Insert review
$sql = "INSERT INTO review (venue_id, post_date, title, body, user_id)
VALUES ('$venue_id', NULL, '$title', '$body', '$user_id')";
$result = mysql_query($sql);
if(!$result) {
echo "Failed to add review!";
} else {
echo "Thankyou for your review. Please click <a href="venue.php?id=" .
$venue_id . "">here</a> to return to the venue's page and see your review.";
}
}
?>[/code]