Skip to content

Instantly share code, notes, and snippets.

@Codercise
Created November 13, 2012 01:33
Show Gist options
  • Save Codercise/4063317 to your computer and use it in GitHub Desktop.
Save Codercise/4063317 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")));
$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