MySQL Tables
I already had a database created on my MySQL system called phpbase; therefore, that's the database I'm using here. I created a table called cgicustomer for this article. Here's the SQL I used to create the table and insert (some rather silly) values into it:
use phpbase; create table cgicustomer ( customerID integer NOT NULL auto_increment, firstname varchar(50), lastname varchar(50), email varchar(50), primary key(customerID) ); insert into cgicustomer (firstname, lastname, email) values ("Hank", "Harshigan", "hank@harshigan.com"); insert into cgicustomer (firstname, lastname, email) values ("Hank", "Williams", "hank@hankwilliams.com"); insert into cgicustomer (firstname, lastname, email) values ("Floyd", "Flabbergaps", "floyd@flabbergaps.com"); insert into cgicustomer (firstname, lastname, email) values ("Floyd", "Pink", "pink@pinkfloyd.com"); insert into cgicustomer (firstname, lastname, email) values ("Lloyd", "London", "lloyd@lloydlondon.com"); insert into cgicustomer (firstname, lastname, email) values ("Erica", "Exagabule", "erica@exagabule.com"); insert into cgicustomer (firstname, lastname, email) values ("Eric", "Theviking", "eric@theviking.com"); insert into cgicustomer (firstname, lastname, email) values ("Jessica", "Jamboliable", "jessica@jamboliable.com"); insert into cgicustomer (firstname, lastname, email) values ("Julia", "Julianopolis", "julia@julianopolis.com");
TIP
Because you're reading this online, I suggest that you simply copy the code from here and paste it right into your MySQL prompt. However, make sure that you have a database called phpbase. Or, if you prefer to use a different database, change the name in this code to your own database's name and be sure to change the name in the C++ code in the next section.
Now notice that this table has two fields that I referred to earlier: firstname and lastname. I gave the values in the HTML form these same names, and I'll use these in the C++ program, too.