Skip to content

Instantly share code, notes, and snippets.

@Burke9077
Created June 29, 2016 20:30
Show Gist options
  • Save Burke9077/d5020a972f06c9841757b28dc5149769 to your computer and use it in GitHub Desktop.
Save Burke9077/d5020a972f06c9841757b28dc5149769 to your computer and use it in GitHub Desktop.
<?php
/**
* Mysqli initial code
*
* User permissions of database
* Create, Alter and Index table, Create view, and Select, Insert, Update, Delete table data
*
* @package PhpFiddle
* @link http://phpfiddle.org
* @since 2012
*/
require_once "dBug!.php";
require "util/public_db_info.php";
$short_connect = new mysqli($host_name, $user_name, $pass_word, $database_name, $port);
$sql = "SELECT id FROM ? LIMIT ?";
$stmt = $short_connect->prepare($sql);
// LIMIT TEST
$limit = 3;
// TABLE NAME TEST
$tableName = "books";
if (!$stmt->bind_param("si", $tableName, $limit)) {
echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
}
$result = $stmt->execute();
$stmt->bind_result($bookID);
while ($stmt->fetch()) {
new dBug($bookID);
}
$short_connect->close();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment