|
@@ -1,5 +1,5 @@
|
|
|
<?php
|
|
|
-
|
|
|
+//Pass query to database and return something
|
|
|
function query($query,$table){
|
|
|
$conn = mysqli_connect("localhost","teabag","teabagpassword",$table);
|
|
|
if($conn->connect_error)
|
|
@@ -21,6 +21,18 @@ function query($query,$table){
|
|
|
$conn->close();
|
|
|
}
|
|
|
|
|
|
+//Write things to database without returning anything
|
|
|
+function queryw($query,$table){
|
|
|
+ $conn = mysqli_connect("localhost","teabag","teabagpassword",$table);
|
|
|
+ if($conn->connect_error)
|
|
|
+ {
|
|
|
+ echo "Unable to connect to database";
|
|
|
+ exit;
|
|
|
+ }
|
|
|
+ $result = $conn->query($query);
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
//Test Code, uncomment this section if you want to test query function with javascript, not recommended
|
|
|
/*
|
|
|
if (isset($_GET['query']) && isset($_GET['table'])){
|