Skip to content

Instantly share code, notes, and snippets.

@anatooly
Created July 12, 2013 05:36
Show Gist options
  • Save anatooly/5982119 to your computer and use it in GitHub Desktop.
Save anatooly/5982119 to your computer and use it in GitHub Desktop.
<?php
$rc = 0;
$host = '127.0.0.1';
$user = 'root';
$password = '';
$database = 'test';
$port = 3306;
$socket = null;
$cflag = 0;
$mysqli = new mysqli($host, $user, $password, $database, $port, $socket);
/* check connection */
if ($mysqli->connect_errno) {
printf("Error %d: Connection failed: %s\n", $mysqli->connect_errno, $mysqli->connect_error);
exit;
}
printf("Connected to MySQL server version: %s\n", $mysqli->server_info);
$sql = 'SELECT * FROM test LIMIT 999990, 10';
$rc = $mysqli->query($sql);
if (! $rc) {
printf("Error %d: Query failed: %s\n", $mysqli->connect_errno, $mysqli->connect_error);
exit;
}
$row = array();
while ($row = $rc->fetch_row()) {
printf("Key: %s, value: %s\n", $row[0], $row[1]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment