Jump to content

CANT YOU SEE WHERE IM GOING WRONG ANYONE?? HELP PLEASE


jigsawsoul

Recommended Posts

I don't get an mysql or php error message. and $apologiesid, $occurrenceid and $staffid are all carry the right information from my testing. but yet it still goes to the else part of the statement. can anyone see why???

 

$query = "INSERT INTO web_roles (apologies_id) VALUES ('$apologiesid') WHERE occurrence_id = '$occurrenceid' AND staff_id = '$staffid'";

if (mysql_query ($query)) {
 $_SESSION['message'] = "
		<div class='notification success 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>
				Your apologies have been sent...
			</div>
		</div>";
		header('Location: list.php');
} 
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');
}

 

[attachment deleted by admin]

Link to comment
Share on other sites

$query = "INSERT INTO web_roles (apologies_id) VALUES ('$apologiesid') WHERE occurrence_id = '$occurrenceid' AND staff_id = '$staffid'";

 

Can anyone see anything wrong with this line of code. ??

DOH! I didn't read your query properly. INSERT statements do not have a WHERE clause.

 

Are you inserting a new record or are you wanting to update an existing record? For updating existing records you should use an UPDATE query.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.