Skip to content

Instantly share code, notes, and snippets.

@BlakeWilliams
Forked from Codercise/new.php
Created November 13, 2012 03:28
Show Gist options
  • Save BlakeWilliams/4063765 to your computer and use it in GitHub Desktop.
Save BlakeWilliams/4063765 to your computer and use it in GitHub Desktop.
<?php
include('../../sqlconnection/config.php');
$business = array(
"name" => $_POST['name'],
"country" => $_POST['country'],
"email" => $_POST['email'],
"phone" => $_POST['phone'],
"website" => $_POST['website'],
"tagline" => $_POST['tagline'],
"category" => $_POST['category'],
"level" => $_POST['level'],
"image" => $_POST['image'],
"writeup" => $_POST['writeup'],
"date" => date('Y-m-d')
);
try {
echo $business["date"];
$DBH = new PDO('mysql:host=localhost;dbname=nickphay_noseyham', $username, $password);
$STH = $DBH->prepare("INSERT INTO business (name, country, email, phone, website, tagline, category,
level, writeup, image, date-created) VALUES (:name, :country, :email, :phone, :website, :tagline,
:category, :level, :writeup, :image, :date)");
$STH->bindParam(':name', $business["name"]);
$STH->bindParam(':country', $business["country"]);
$STH->bindParam(':email', $business["email"]);
$STH->bindParam(':phone', $business["phone"]);
$STH->bindParam(':website', $business["website"]);
$STH->bindParam(':tagline', $business["tagline"]);
$STH->bindParam(':category', $business["category"]);
$STH->bindParam(':level', $business["level"]);
$STH->bindParam(':writeup', $business["writeup"]);
$STH->bindParam(':image', $business["image"]);
$STH->bindParam(':date', strtotime(date("Y-m-d"), PDO::PARAM_STR)));
$STH->execute();
} catch(PDOException $e) {
echo $e;
echo "bad times :(";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment