" . $db_server->connect_error . "
"); } else { // We successfully connected to the database // The query is a php string $query = "INSERT INTO customers(cname, street, zip, phone) VALUES ('" . $_POST['cname'] . "', '" . $_POST['street'] . "', '" . $_POST['zip'] . "', '". $_POST['phone'] . "');"; $customers_result = $db_server->query($query); if (!$customers_result) { /* If there was an error executing the query, the result will be false, otherwise its a mysql result resource. */ print ("" . $db_server->error . "
"); } else { print "Address: " . $_POST['street'] . ", " . $_POST['zip'] . "
"; print "Phone #: " . $_POST['phone'] . "
"; print "Customer #: " . $db_server->insert_id . "
"; print "Return to Customer View"; } } // You should always close server connections when you're done $db_server->close(); if ($db_server->connect_errno) { // connect_error returns the a string of the error from the latest sql command print ("" . $db_server->connect_error . "
"); } } ?>