"; PRINT "Insert New Transaction"; PRINT ""; $dbname = "example"; $cid = $_POST["cid"]; $pid = $_POST["pid"]; $tdate = $_POST["tdate"]; $tqnt = $_POST["tqnt"]; /* MySQL table created to store the data */ $tablename = "transaction"; /* 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 "You identified yourself as $username."; PRINT "
"; PRINT "You issued the following INSERT query:
"; PRINT ""; PRINT "
"; /* Insert information into table */ $query = "INSERT INTO $tablename VALUES('$cid','$pid', '$tdate', '$tqnt')"; $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(); ?>