Hello! Welcome to my website.
Please tell me your name.
"; } // End pass == 1 /* If pass>= 1 AND <= 7, then let's present the trials or items. Each time through, we increment pass by a value of 1. Thus, we end the "loop" once pass is 8 or higher. */ // We're going to skip the instructions this time, so setting $pass <= 6 instead of <= 7 if($pass >= 2 AND $pass <= 6){ print " "; } // End if($pass >= 2 OR $pass <= 6) if($pass == 7){ /* SQL code to create the table. We need to run this once in phpMyAdmin CREATE TABLE demo1 ( user_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT, v01 VARCHAR(1) NOT NULL, v02 VARCHAR(1) NOT NULL, v03 VARCHAR(1) NOT NULL, v04 VARCHAR(1) NOT NULL, v05 VARCHAR(1) NOT NULL, myname VARCHAR(60) NOT NULL, submission_daate DATETIME NOT NULL, PRIMARY KEY (user_id) ); Open a MySQL connection */ // Set the database access information as constants /* The reason we do this in a two-step process is (a) It makes it easier for us to see, at a glance, what the relevant parameters are. Thus we can update things via copy-and-paste from one application to the next with little effort. (b) It is slightly more secure this way. */ DEFINE ('DB_USER', 'rcfraley'); DEFINE ('DB_PASSWORD', '*password*'); DEFINE ('DB_HOST', 'yourpersonality.netfirmsmysql.com'); DEFINE ('DB_NAME', 'class'); // Open the database connection: $dbc = @mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die ('Could not connect to MySQL: ' . mysqli_connect_error() ); // Create a string that represents the database querry $q = "INSERT INTO demo1 (v01,v02,v03,v04,v05,myname,submission_daate) VALUES ('$v01','$v02','$v03','$v04','$v05','$myname',NOW() )"; // Run the query $r = @mysqli_query ($dbc, $q); /* If the query ran with no errors, what is returned ($r) will 'exist' Thus, we can make our next steps (e.g., saying thank you) contingent upon a successful return of $r. If we are requesting information from the databse (vs. INSERTing information in it), $r will hold those values and we can sort through them using loops. */ if ($r) { // If it ran OK. print "Your data have been saved. Thank you for your participation!Hope you're feeling more lively later today! Coffee helps.
"; } // Close the database connection. mysqli_close($dbc); } // End pass == 7 ?>