Commits

Alexander Dahl  committed e40aec3 Draft

create sql and php files for chapter 9

  • Participants
  • Parent commits 981297b

Comments (0)

Files changed (4)

File page329.html

         </div>
         <div id="new">
             <h4>Add New Finisher</h4>
-            <form id="addRunner" name="addRunner" action="service.php" method="POST">
+            <form id="addRunner" name="addRunner" action="page343.php" method="POST">
                 First Name: <input type="text" name="txtFirstName" id="txtFirstName" /> <br />
                 Last Name: <input type="text" name="txtLastName" id="txtLastName" /> <br />
                 Gender: <select id="ddlGender" name="ddlGender">
+create database hfjq_race_info;
+
+CREATE USER 'runner_db_user'@'localhost' IDENTIFIED BY 'runner_db_password';
+GRANT SELECT,INSERT,UPDATE,DELETE ON hfjq_race_info.* TO 'runner_db_user'@'localhost';
+
+use hfjq_race_info;
+
+CREATE TABLE runners(
+    runner_id INT not null AUTO_INCREMENT,
+    first_name VARCHAR(100) not null,
+    last_name VARCHAR(100) not null,
+    gender VARCHAR(1) not null,
+    finish_time VARCHAR(10),
+    PRIMARY KEY (runner_id)
+);
+insert into runners (first_name, last_name, gender, finish_time) values ('John','Smith','m','25:31') ;
+insert into runners (first_name, last_name, gender, finish_time) values ('Jacob','Walker','m','25:54') ;
+insert into runners (first_name, last_name, gender, finish_time) values ('Mary','Brown','f','26:01') ;
+insert into runners (first_name, last_name, gender, finish_time) values ('Jenny','Pierce','f','26:04') ;
+insert into runners (first_name, last_name, gender, finish_time) values ('Frank','Jones','m','26:08') ;
+insert into runners (first_name, last_name, gender, finish_time) values ('Bob','Hope','m','26:38') ;
+insert into runners (first_name, last_name, gender, finish_time) values ('Jane','Smith','f','28:04') ;
+insert into runners (first_name, last_name, gender, finish_time) values ('Ryan','Rice','m','28:24') ;
+insert into runners (first_name, last_name, gender, finish_time) values ('Justin','Jones','m','29:14') ;
+<?php
+
+    mysql_connect('127.0.0.1', 'runner_db_user', 'runner_db_password')
+        OR die( 'Could not connect to database.');
+    mysql_select_db('hfjq_race_info');
+
+    echo "Connected!";
+
+?>