Revisions
-
BlakeWilliams revised this gist
Nov 13, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -29,7 +29,7 @@ $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; -
Codercise revised this gist
Nov 13, 2012 . 1 changed file with 3 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -14,13 +14,11 @@ "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"]); @@ -31,9 +29,10 @@ $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 :("; } ?> -
Codercise created this gist
Nov 13, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ <?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 { $date = date('Y-m-d'); echo $business["date"]; $DBH = new PDO('mysql:host=localhost;dbname=nickphay_noseyham', $username, $password); $data = array( 'name' => 'Cathy', 'addr' => 'herp derp', 'city' => 'cardiff' ); $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, NOW())"); $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->execute(); } catch(PDOException $e) { echo "bad times :("; //file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); } ?>