Jump to content

You have an error in your SQL syntax ??


jigsawsoul

Recommended Posts

I have this error but can't seem why. everything looks just fine to me.

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE web_roles.staff_id=web_staff.staff_id LEFT JOIN web_login WHERE web_s' at line 2

 

$query = "INSERT INTO web_roles (occurrence_id, staff_id, role) VALUES ('$occurrenceid', '$chairperson', 'Chairperson')";

if (mysql_query ($query)) {

$result = 	"SELECT * FROM web_roles 
				LEFT JOIN web_staff WHERE web_roles.staff_id=web_staff.staff_id
				LEFT JOIN web_login WHERE web_staff.login_id=web_login.login_id
				WHERE web_roles.occurrence_id = '$occurrenceid' AND web_roles.staff_id = '$chairperson'";
$result = mysql_query ($result) or die (mysql_error());
$row = mysql_fetch_assoc($result);

$email = $row['email'];
$subject = "Meeting System, Appointed Chairperson Notification" ;
$message = "You have been appointed as the chairperson for a meeting, please login and perform the required steps";
	mail("$email", "Subject: $subject", $message, "From: [email protected]" );
} 
else {
	$_SESSION['message'] = "
		<div class='notification error png_bg'>
			<a href='#' class='close'><img src='http://stuweb.cms.gre.ac.uk/~hr728/_web/_resources/images/icons/cross_grey_small.png' title='Close this notification' alt='close' /></a>
			<div>
				Error. please can't admin
			</div>
		</div>";
header('Location: list.php');
}

Link to comment
https://forums.phpfreaks.com/topic/189625-you-have-an-error-in-your-sql-syntax/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.