Created
January 3, 2018 16:46
-
-
Save stevenwadejr/1ee6fe6b306d427fce72182d30dcef7c to your computer and use it in GitHub Desktop.
This is the very first PHP script I ever wrote (circa 2007)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$hostname = "localhost"; | |
$db_user = "swade_steven"; | |
$db_password = "yeahman"; | |
$db_table = "upstate_show"; | |
$db = mysql_connect($hostname, $db_user, $db_password); | |
mysql_select_db("swade_information"); | |
?> | |
<html> | |
<head> | |
<title>18th Annual Upstate High School Art Exhibit</title> | |
</head> | |
<body> | |
<hr> | |
<?php | |
if (isset($_REQUEST['Submit'])) | |
{ | |
# THIS CODE TELL MYSQL TO INSERT THE DATA FROM THE FORM INTO YOUR MYSQL TABLE | |
$sql = "INSERT INTO $db_table(name,grade,homePhone,homeAddress,homeCity,homeState,homeZip,homeCounty,title,category,height,width,depth,media,schoolName,principal,instructor,schoolAddress,schoolCity,schoolState,schoolZip,schoolCounty,schoolPhone) values ('$name','$grade','$homePhone','$homeAddress','$homeCity','$homeState','$homeZip','$homeCounty','$title','$category','$height','$width','$depth','$media','$schoolName','$principal','$instructor','$schoolAddress','$schoolCity','$schoolState','$schoolZip','$schoolCounty','$schoolPhone')"; | |
if($result = mysql_query($sql ,$db)) | |
{ | |
echo "Thank you for your entry"; | |
} | |
else | |
{ | |
echo "ERROR: ".mysql_error(); | |
} | |
} | |
else | |
{ | |
?> | |
<?php | |
} | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pretty much every bit of this was copy/pasted from StackOverflow. I didn’t even understand what it was doing but I knew I needed insert something into a database. ¯\(ツ)/¯