diff --git a/Index.php b/Index.php new file mode 100644 index 0000000..c90a0b5 --- /dev/null +++ b/Index.php @@ -0,0 +1,354 @@ + + + +
+ + + + + + +This blog is to document Code_Mates, a programming training group that meets every Saturday. We are based in Austin.
+There are four people. Matt Elliot (Developer 1) and +Tim Macaulay-Robinson (Developer 2) who have 20 years+ each experience. +Vicky Barnato (me) & Travis Austin who are non techs. Both of us come from +BA backgrounds and are programming novices.
+ +Our goals: +Matt Elliot: Enhance tech communication and training skills by getting two civilians ready for programming jobs in one year. +Tim Macaulay-Robinson: Ditto.
+ +Vicky Barnato (me) & Travis Austin: Travis wants to move from Business Analysis to programming. ++I want to be less dependent on developers’ explanations to understand how technology works. +This blog documents the projects and tasks that Tim and Matt set Travis and me to teach us. +These will be basic tasks at first. Readers with programming experience may find the first couple of posts too basic.
+Please be patient we are novices! The first part of this post documents how I attempted to create an online guestbook form. +Please let me know if you see any mistakes or want additional explanations. +SQL was used for the database, html for the form and PHP to connect the two.
+ +The task was broken down by Tim into these steps: +My code:
+ + + + CREATE DATABASE guestbook2;+ //You should see this message: “Query OK, 1 row affected (0.00 sec)”
+ USE guestbook2+ //You should see this message “Database changed”
+ CREATE TABLE guest ( + guestID int, + guestname text, + sign_date date, + comments varchar(30), + reason varchar(30) + );+ //You should see this message "Query OK, 0 rows affected (0.01 sec)"
+ +Below is the html form guestbook2.php where guests will input data:
+ + ++
+ ++ +
+ +
Below is the code from insert_guest.php file which sets up the connection between the guestbook2 database and the html form
+ +$conn = mysqli_connect("localhost","username","password","guestbook2");
+//you will need to input username and password to set up the connection
+ +// Check connection
+if (mysqli_connect_errno())
+{ + echo "Failed to connect to MySQL: " . mysqli_connect_error();
+}
+// not used connection
+// $myPDO = new PDO('mysql:host=localhost;dbname=guestbook2', 'username', 'password');
+ +if ($_POST) {
+ +$sql="INSERT INTO guest (guestname, comments, reason) VALUES ('".$_POST['guestname']."', '".$_POST['comment']."', '".$_POST['reason']."')";
+ +if ($conn->query($sql) === TRUE) {
+echo "New record created successfully";
+} else {
+ echo "Error: " . $sql . "
" . $conn->error;
} + } + ?>
+ + + + + + + + + + + + + + ++ + + + + + + + + +
+ + + + + + + + + +