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); ?> 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? 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. 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"? 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 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
Archived
This topic is now archived and is closed to further replies.