pgrevents Posted May 13, 2009 Share Posted May 13, 2009 <?php if ($_POST['part1'] =="yes"){ $name_post = $_POST['contact_name']; $email_post = $_POST['contact_email']; $unique_post = rand(487546515116548413561, 156489491961841561654484456216515); $country_ident = $_POST['country']; $complete = "complete"; mysql_connect("localhost","user","pass"); mysql_select_db("user"); if(mysql_query("INSERT INTO details (name, email, unique) VALUES('$name_post', '$email_post', '$unique_post' ) ")) { setcookie("first", "complete", time()+3600); $_SESSION['country'] = $_POST['country']; $_SESSION['unique'] = $unique_post; $_SESSION['email'] = $_POST['contact_email']; $headerlocation = "1"; } else { $headerlocation = "2"; } ///blah blah blah rest of it works ?> Hi peeps I ahve pasted the code that is the issue. I have had it working before but as soon as i add the UNIQUE into the mix it throws back mysql error I have set the script to fall back if there is a problem inserting. This is the first time i have seen this message and it was only since I added it to the script. I have tried everything in my knowledge (pretty limited) but still not getting no where. any help would be great thanks Quote Link to comment https://forums.phpfreaks.com/topic/157898-solved-inserting-into-database/ Share on other sites More sharing options...
pgrevents Posted May 13, 2009 Author Share Posted May 13, 2009 it doesnt like the word unique does it. i changed name on table and in script all is good lol Quote Link to comment https://forums.phpfreaks.com/topic/157898-solved-inserting-into-database/#findComment-832926 Share on other sites More sharing options...
xtopolis Posted May 13, 2009 Share Posted May 13, 2009 http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html Quote Link to comment https://forums.phpfreaks.com/topic/157898-solved-inserting-into-database/#findComment-832945 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.