unistake Posted July 13, 2010 Share Posted July 13, 2010 Hi all could you take a look at this. I think I have gone wrong somewhere in the syntax as I can not find the problem in a spelling error etc. I could do with using someone elses eyes on this one! It is coming up with the result "Couldn't execute query" - I have tested all the $_POST[values] that have echoed fine. Thanks for the help. $cxn = mysqli_connect($host, $user, $passwd,$dbname) or die ("Unable to connect!"); $sql = "SELECT email FROM Members WHERE email='$_POST[email]'"; $result = mysqli_query($cxn,$sql) or die ("Couldn't execute query"); $num = mysqli_num_rows($result); if ($num >0) // Login Name found { echo "The email address '$_POST[email]' is already registered!"; } else // Login Name not found { $today = date("Y-m-d h:i:s"); $query = "INSERT INTO Members (id,name,email,telephone,password,icao,joined) VALUES ('','$_POST[name]','$_POST[email]','$_POST[telephone]','$_POST[password]','$_POST[code],'$today')"; $result1 = mysqli_query($cxn,$query) or die ("Can't execute insert query"); echo "You have successfully registered!"; } Link to comment https://forums.phpfreaks.com/topic/207611-insert-into-not-working/ Share on other sites More sharing options...
gwolgamott Posted July 13, 2010 Share Posted July 13, 2010 Misssing an ' in the insert query after the '$_POST[code] [/code] Link to comment https://forums.phpfreaks.com/topic/207611-insert-into-not-working/#findComment-1085367 Share on other sites More sharing options...
unistake Posted July 13, 2010 Author Share Posted July 13, 2010 good eyes gwolgamott! Thanks a bunch! Link to comment https://forums.phpfreaks.com/topic/207611-insert-into-not-working/#findComment-1085369 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.