aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'client.php')
-rw-r--r--client.php19
1 files changed, 11 insertions, 8 deletions
diff --git a/client.php b/client.php
index e2284b4..56313ae 100644
--- a/client.php
+++ b/client.php
@@ -21,13 +21,16 @@
echo "Job sent, handle was ".$handle." - hash ".$handlehash."\n";
- $db = mysql_connect(MYSQL_HOSTNAME, MYSQL_USERNAME, MYSQL_PASSWORD);
- if (!$db) {
- die("Could not connect to database ".mysql_error());
+ $db = new mysqli(MYSQL_HOSTNAME, MYSQL_USERNAME,
+ MYSQL_PASSWORD, MYSQL_DATABASE);
+ if (mysqli_connect_errno()) {
+ die("Could not connect to database ".mysqli_connect_error());
}
- mysql_select_db(MYSQL_DATABASE);
- $query = "INSERT INTO builds (id, handle)".
- ." VALUES('".$handlehash."','".$handle."')";
- mysql_query($query);
- echo "Job handle mapping added to database\n";
+ $query = "INSERT INTO builds (id, handle) VALUES(?, ?)";
+ $stmt = $db->prepare($query);
+ $stmt->bind_param("ss", $handlehash, $handle);
+ $stmt->execute();
+ $stmt->close();
+ $db->close();
+ echo "Job handle mapping added to database\n"; \ No newline at end of file