connect_errno) { // connect_error returns the a string of the error from the latest sql command print ("

There was an error:

" . $db_server->connect_error . "

"); } else { // We successfully connected to the database // The query is a php string if (isset($_POST['cno'])) { $query = "UPDATE customers SET cname='" . $_POST['cname'] . "', street='" . $_POST['street'] . "', zip='" . $_POST['zip'] . "', phone='". $_POST['phone'] . "' WHERE cno='". $_POST['cno'] . "';"; $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 ("

There was an error:

" . $db_server->error . "

"); } else { print "

The new record is:

"; print "

Name: " . $_POST['cname'] . "

"; print "

Address: " . $_POST['street'] . ", " . $_POST['zip'] . "

"; print "

Phone #: " . $_POST['phone'] . "

"; 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 ("

There was an error:

" . $db_server->connect_error . "

"); } } ?>