sqlite_query() [function.sqlite-query]: no such table: friends in D:\wamp\www\sqllite\index.php on line 11
查询错误:SQL逻辑错误或缺少数据库
i am facing with this error. the data base ios connected correct.but it shows that no table
my source code of php is this
$db = "testdb.db";
echo $db;
$handle = sqlite_open($db) or die("Could not open database".sqlite_error_string(sqlite_last_error($handle)));
$query = ("SELECT * FROM friends");
$result = sqlite_query($handle,$query) or die("Error in query: ".sqlite_error_string(sqlite_last_error($handle)));
if (sqlite_num_rows($result) > 0) {
while($row = sqlite_fetch_array($result)) {
echo $row[0];
echo $row[1];
echo $row[2];
}
}
sqlite_close($handle);
?>
和我的数据库文件源代码是它的名字是testdb.db
$dbhandle = sqlite_open('db/test.db', 0666, $error);
if (!$dbhandle) die ($error);
$stm = "CREATE TABLE Friends(Id integer PRIMARY KEY," .
"Name text UNIQUE NOT NULL, Sex text CHECK(Sex IN ('M', 'F')))";
$ok = sqlite_exec($dbhandle, $stm, $error);
if (!$ok)
die("Cannot execute query. $error");
echo "Database Friends created successfully";
sqlite_close($dbhandle);
答案 0 :(得分:0)
表朋友!=朋友
检查: - )