atticus Posted June 20, 2012 Share Posted June 20, 2012 I have verified all connection and table data is connect. I typically do not use mysqlli. What am I doing wrong: <?php error_reporting(E_ALL); ini_set('display_errors', '1'); $id = $_POST['id']; $name = $_POST['Name']; $email = $_POST['Email']; $phone = $_POST['Phone']; $city = $_POST['City']; echo $name; ////// Connect to DB $mysqli = new mysqli("db", "user", "pass", "db"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $query = "INSERT INTO person(name,email,phone,city) VALUES ('$name','$email','$phone','$city') WHERE person_id = $id" or die('Could not connect: ' . mysql_error()); $mysqli->query($query); ?> Quote Link to comment https://forums.phpfreaks.com/topic/264501-mysqlli-insert-querynot-working-no-errors/ Share on other sites More sharing options...
Guest MrLeN Posted June 20, 2012 Share Posted June 20, 2012 Maybe Name is name on the form? Quote Link to comment https://forums.phpfreaks.com/topic/264501-mysqlli-insert-querynot-working-no-errors/#findComment-1355465 Share on other sites More sharing options...
atticus Posted June 20, 2012 Author Share Posted June 20, 2012 Name is Name on form. Echo $name confirms $_POST is working. Quote Link to comment https://forums.phpfreaks.com/topic/264501-mysqlli-insert-querynot-working-no-errors/#findComment-1355467 Share on other sites More sharing options...
atticus Posted June 20, 2012 Author Share Posted June 20, 2012 Should I be using a different error reporting method with mysqlli instead of "or die"? Quote Link to comment https://forums.phpfreaks.com/topic/264501-mysqlli-insert-querynot-working-no-errors/#findComment-1355468 Share on other sites More sharing options...
atticus Posted June 20, 2012 Author Share Posted June 20, 2012 Okay, I feel like an idiot...should be using UPDATE instead of INSERT Quote Link to comment https://forums.phpfreaks.com/topic/264501-mysqlli-insert-querynot-working-no-errors/#findComment-1355469 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.