本文整理匯總了PHP中api::query方法的典型用法代碼示例。如果您正苦於以下問題:PHP api::query方法的具體用法?PHP api::query怎麽用?PHP api::query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類api
的用法示例。
在下文中一共展示了api::query方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: mysqli
}
$table = DB_NAME;
echo "Connecting ... <br>";
$mysql = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, '', DB_PORT);
echo "Connected .. <br>";
if ($mysql->connect_error) {
die($mysql->connect_error);
}
echo "Creating datatbase ... <br>";
$mysql->query("CREATE DATABASE IF NOT EXISTS " . DB_NAME);
echo "Database created <br>";
echo "Filling with Tables <br>";
$mysql->select_db($table);
$mysql->query("CREATE TABLE IF NOT EXISTS users(id INT NOT NULL AUTO_INCREMENT, username VARCHAR(16) NOT NULL, password VARCHAR(64) NOT NULL, token VARCHAR(23), time DATETIME, PRIMARY KEY(id))");
echo "Finished ... <br>";
echo 'Inserting User and getting up ... <br>';
echo "\n";
try {
print_r($api->sign_up("Hallo", hash("sha256", "Hallo"), hash("sha256", "Hallo")));
$pass = hash("sha256", "Hallo");
$api->query("INSERT INTO users(username, password) VALUES ('Hallo', {$pass}");
} catch (Exception $e) {
echo $e->getTraceAsString();
echo "\n at :" . $e->getLine();
}
echo "\n";
echo 'User Hallo with Password Hallo inserted ...<br>';
echo 'Created the SQL and made Tables ...<br> ';
echo '<iframe src="../login"></iframe>';
echo "\n";
echo '<a href="../index.php">Go Back</a>';