"jackigsd_jack","password" => "asdfgh13"); // this is the connect function which I can call and edit/modify the parameters to connect to databases for PDO function connect($config) { try { $conn = new PDO('mysql:host=localhost;dbname=jackigsd_flowerRoom', $config['username'], $config['password']); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); return $conn; //read about returns } catch (Exception $e) { return false; } } // this is a query for inserting/showing/ etc.... again this connects via PDO function regular_query($query, $bindings, $conn) { $stmt = $conn->prepare($query); $stmt->execute($bindings); $results = $stmt->fetchAll(PDO::FETCH_ASSOC); return $results ? $results : false; } function count_query($query, $bindings, $conn) { $stmt = $conn->prepare($query); $stmt->execute($bindings); $results = $stmt->rowCount(); return $results ? $results : false; } function delete_query($query, $bindings, $conn) { $stmt = $conn->prepare($query); $stmt->execute($bindings); } function insert_query($query, $bindings, $conn) { $stmt = $conn->prepare($query); $stmt->execute($bindings); } $conn = connect($config); $allResults = regular_query("SELECT * FROM flowerRoom",[],$conn); $recentlyAdded = regular_query("SELECT * FROM flowerRoom ORDER BY id DESC LIMIT 1", [], $conn); if (isset($_POST["btnSubmit"], $_POST["strainName"], $_POST["generation"], $_POST["vegDate"], $_POST["flowerDate"], $_POST["seedlingClone"])) { $STRAINNAME = htmlentities($_POST["strainName"]); $GENERATION = (INT)htmlentities($_POST["generation"]); $VEGDATE = htmlentities($_POST["vegDate"]); $FLOWERDATE = htmlentities($_POST["flowerDate"]); $SEEDLINGCLONE = (string)htmlentities($_POST["seedlingClone"]); insert_query("INSERT INTO flowerRoom (strainName, generation, vegDate, FlowerDate, seedlingClone) VALUES (:strainName, :generation, :vegDate, :FlowerDate, :seedlingClone)", ["strainName" => $STRAINNAME, "generation" => $GENERATION, "vegDate" => $VEGDATE, "FlowerDate" => $FLOWERDATE, "seedlingClone" => $SEEDLINGCLONE],$conn); header("Location: index.php"); } if (isset($_POST["delete_this"], $_POST["delete_id"]) && is_numeric($_POST["delete_id"])) { $chk_for_id = count_query("SELECT * FROM flowerRoom WHERE id = :id LIMIT 1", ["id" => $_POST["delete_id"]], $conn); if ( $chk_for_id == 1 ) { delete_query("DELETE FROM flowerRoom WHERE id = :id", ["id" => $_POST["delete_id"]], $conn); } header("Location: index.php"); } ?>

Strain Name:

Generation:

Veg Date:

FlowerDate:

End of Flower:

Type:

FlowerRoom

Flower Room v1.0


Today: Foilar Feed

Sour Diesel #1 is done on 2.21.15

Home

Calendar Page

Plant Veg Flower
Sour Diesel #110.21.1412.21.14
Sour Diesel #210.21.1412.21.14
Sour Diesel #310.21.1412.21.14
OG Kush #111.25.141.21.14
OG Kush #211.25.141.21.14
OG Kush #311.25.141.21.14
Williams Wonder #111.25.141.21.14

Back

Page Footer

Home

Task Manager

Task to add:


Date of task:

Page Footer

Home

Finished Plants History

Plant Total Grow Time Dry Weight
Sour Diesel #198 days151g
Sour Diesel #298 days142g
Sour Diesel #3100 days160g
OG Kush #186 days100g
OG Kush #286 days131g
OG Kush #386 days120g
Williams Wonder #186 days115g

Back

Page Footer