Re: Insert query error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris,

Why not escape, and extract the data prior to Insert string?

On 06/08/2011 05:41, Chris Stinemetz wrote:
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())";


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux