Insert query error
| From: | Chris Stinemetz | Date: | Sat, 06 Aug 2011 04:41:06 +0000 |
| Subject: | Insert query error | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-47951@lists.php.net to get a copy of this message | ||
I am getting the following error trying to run the below query. Any
suggestions on what I am doing wrong?
Thank you,
Something went wrong while inserting your store visitCannot add or
update a child row: a foreign key constraint fails (
store.posts,
CONSTRAINT posts_ibfk_1 FOREIGN KEY (post_store) REFERENCES
stores (store_id) ON DELETE CASCADE ON UPDATE CASCADE)
$sql = "INSERT INTO
posts(market, type, post_store, post_tptest, post_content, post_by, post_date)
VALUES('" . mysql_real_escape_string($_POST['market']) . "',
'" . mysql_real_escape_string($_POST['type']) . "',
'" . mysql_real_escape_string($_POST['post_store']) . "',
'" . sha1($_POST['post_tptest']) . "',
'" . mysql_real_escape_string($_POST['post_content']) . "',
" . $_SESSION['user_id'] . ",
NOW())";