Itutorial
Legendary OT User
- Joined
- Dec 23, 2014
- Messages
- 2,338
- Solutions
- 68
- Reaction score
- 1,022
Trying to change my sql code to statements but can't figure this out.
It seems like getting error messages with statements isnt very easy.
PHP:
function getServerList($startID, $endID) {
$conn = connectDB();
$stmt = $conn->prepare("SELECT * FROM servers WHERE id >= ? AND id <= ?");
$stmt->bind_param('ii', $startID, $endID);
$serverArrays = array();
if ($result = $stmt->execute()) {
do {
while ($row = $result->fetch_assoc()) {
$tmpArray = array();
$tmpArray[0] = $row['id'];
$tmpArray[1] = $row['name'];
$tmpArray[2] = $row['ip'];
$tmpArray[3] = $row['protocol'];
$tmpArray[4] = $row['port'];
$tmpArray[5] = $row['players'];
$tmpArray[6] = $row['maxplayers'];
$tmpArray[7] = $row['exprate'];
$tmpArray[8] = $row['website'];
array_push($serverArrays, $tmpArray);
}
$result->free_result();
} while ($result->next_result());
}
$conn->close();
return $serverArrays;
}
It seems like getting error messages with statements isnt very easy.