diff options
Diffstat (limited to 'client.php')
-rw-r--r-- | client.php | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -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 |