callisto11 Posted July 16, 2008 Share Posted July 16, 2008 Hi Everyone, Im getting this sql error message on my website, which I dont understand, I know it has nothing to do with php. I was just hoping someone with php and sql experience will understand it and explain it more to me what I have done wrong. Thank you ??? Error Message: Cannot add or update a child row: a foreign key constraint fails (`rm_production/new_order`, CONSTRAINT `new_order_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`)) Quote Link to comment Share on other sites More sharing options...
awpti Posted July 17, 2008 Share Posted July 17, 2008 Contact the developer of the application. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted July 17, 2008 Share Posted July 17, 2008 i would be happy to assist if you pasted more code Quote Link to comment Share on other sites More sharing options...
callisto11 Posted July 17, 2008 Author Share Posted July 17, 2008 To darkfreaks, This is the code of what Im trying to do: <?php session_start(); require "connect.php"; $email = $_SESSION['email']; $quantity = $_GET['quantity']; $query = "insert into new_order values (0,'".$date_of_order."','".$date_paid."',0,'".$customer_id."')"; $result = mysql_query($query, $connection) or die (mysql_error ()); $order_id = mysql_insert_id($connection); foreach($_SESSION['cart'] as $key => $cartoon) { $query = "insert into general_cartoon_order ('".$order_id."','".$_SESSION['cart'][$key]['cartoon_id']."','".$_SESSION['cart'][$key]['date']."','".$_SESSION['cart'][$key]['quantity']."','".$_SESSION['cart'][$key]['size']."','".$_SESSION['cart'][$keys]['price']."')"; echo $query; $result = @mysql_query($query, $connection) or die ("Unable to perform query<br>$query"); } unset($_SESSION['cart']); header("Location: rmcheckout.php"); exit(); ?> Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted July 17, 2008 Share Posted July 17, 2008 remove the @ it supress error Quote Link to comment Share on other sites More sharing options...
callisto11 Posted July 17, 2008 Author Share Posted July 17, 2008 To darkfreaks, It still giving the same error! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.