"; PRINT "Insert New Customer"; PRINT ""; $dbname = "example"; $cname = $_POST["cname"]; $ccity = $_POST["ccity"]; $cphone = $_POST["cphone"]; /* MySQL table created to store the data */ $tablename = "customer"; /* make connection to database */ MYSQL_CONNECT("localhost","nis","thomas") OR DIE("Unable to connect to database server"); @mysql_select_db("$dbname") or die("Unable to select database"); $today = date("Y-m-d"); PRINT "Today is: $today.
"; PRINT "
"; PRINT "You issued the following INSERT query:
"; PRINT ""; PRINT "
"; /* Insert information into table */ $query = "INSERT INTO $tablename VALUES('$cname','$ccity', '$cphone', 'null')"; $result = MYSQL_QUERY($query); PRINT "Database server response:
"; if($result != 0){ $affected_rows = mysql_affected_rows(); PRINT "Query OK. Rows affected $affected_rows"; }else{ PRINT "Query FAILED. Probably you don't have the proper access rights!"; } PRINT "
"; PRINT "Back"; PRINT ""; PRINT ""; /* Close the database connection */ MYSQL_CLOSE(); ?>