本文整理汇总了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>';