我正在使用MYSQLi(从此网站:http ://codular.com/php-mysqli )得到空白页。
<html>
<body>
<h1>TEST21</h1>
<?php
error_reporting(E_ALL); ini_set('display_errors', 1);
$db = new mysqli('localhost', 'Brendan', 'password', 'Library');
if($db->connect_errno > 0){
die('Unable to connect to database [' . $db->connect_error . ']');
}
echo "STEP1";
//STEP 2
$sql = <<<SQL
SELECT *
FROM 'BOOK'
WHERE 'ISBN10' > 0
SQL;
if(!$result = $db->query($sql)){
die('There was an error running the query [' . $db->error . ']');
}
echo "STEP2";
?>
</body>
HEREDOC的怪异之处在于,结束标识符不得包含任何前导空格(不得缩进)。请在此处查看重要警告-http: //php.net/manual/language.types.string.php#language.types.string.syntax.heredoc
您在查询中还使用了错误的引号字符。我会简化到这一切...
$sql = 'SELECT * FROM `BOOK` WHERE `ISBN10` > 0';
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句