Learning PHP and MySQL
Chapter 16 Code
Wednesday, September 27, 2006
Example 16-8 SQL to create the users table (may have already been created
CREATE TABLE `users` (
`user_id` int(11) NOT NULL auto_increment,
`first_name` varchar(100) NOT NULL,
`last_name` varchar(100) NOT NULL,
`username` varchar(45) NOT NULL,
`password` varchar(32) NOT NULL, PRIMARY KEY (`user_id`));
SQL code returns, again, that the query value was OK.
Query OK, 0 rows affected (0.02 sec)
Posted by krautgrrl on 09/27 at 11:40 AM
Chapter 16 Code • (4) Comments • (1) Trackbacks • Permalink
Chapter 16 Code • (4) Comments • (1) Trackbacks • Permalink
Example 16-9 Inserting sample data for the tables
INSERT INTO categories VALUES (1,'Press Releases'); INSERT INTO categories VALUES (2,'Feature Requests');
INSERT INTO posts VALUES (NULL,1,1,'PHP Version 12','PHP Version 12, to be released third quarter 2006. Featuring the artificial inteligence engine that writes the code for you.',NULL);
INSERT INTO posts VALUES (NULL,1,1,'MySQL Version 8','Returns winning lotto number.',NULL);
INSERT INTO posts VALUES (NULL,2,2,'Money Conversion',' Please add functions for converting between foreign currentcies. ',NULL);
INSERT INTO comments VALUES (NULL,1,1,'Correction','Release delayed till the year 2099',NULL);
INSERT INTO users VALUES (NULL,'Michele','Davis','mdavis',md5('secret')); INSERT INTO users VALUES (NULL,'Jon','Phillips','jphillips',md5('password'));
You should see a result similar to the one below for each of the INSERT SQL commands.
Query OK, 1 row affected, 1 warning (0.03 sec)
Posted by krautgrrl on 09/27 at 11:41 AM
Chapter 16 Code • (2) Comments • (4) Trackbacks • Permalink
Chapter 16 Code • (2) Comments • (4) Trackbacks • Permalink
Statistics
This page has been viewed 375175 times
Page rendered in 0.4047 seconds
Total Entries: 224
Total Comments: 16
Total Trackbacks: 307338
Most Recent Entry: 09/27/2006 12:39 pm
Most Recent Comment on: 10/26/2007 10:00 am
Total Members: 2
Total Logged in members: 0
Total guests: 8
Total anonymous users: 0
Most Recent Visitor on: 02/10/2012 09:11 am
The most visitors ever was 1103 on 11/20/2007 12:50 pm
