我是使用sqlite3处理html和php的初学者。我在网上找不到解决方案,当我执行insert语句时,它不会被插入。
任何提示都有助于解决此问题。updatec是来自不同html文件的单选按钮条目。
if($updateC == 'Insert') {
$sql = "INSERT INTO MANGA_BOOK (Title,Author,Genre,ISBN_number,Age_rating,Language,Book_review,Price)
VALUES ('$Btitle', '$BAuthor', '$BGenre', '$BISBN', '$age', '$lan', '$bookRev', '$pr')";
$enterInto = $db->exec($sql);
$sql2 = "INSERT INTO SELLS (M_ISBN, S_ID, Copies) VALUES ('$BISBN', '$storeNum', '$cop')";
$enterInto2 = $db->exec($sql2);
}
$rowCount = $db->querySingle("SELECT COUNT(*) FROM SELLS");
$sql = "SELECT DISTINCT Title, Author, ISBN_number, Copies, S_ID
FROM MANGA_BOOK
NATURAL JOIN SELLS
ORDER BY S_ID";
$results = $db->query($sql);
if($rowCount > 0) {
echo '<table> <tr>';
echo '<th>Title</th>';
echo '<th>Author</th>';
echo '<th>ISBN_number</th>';
echo '<th>Copies</th>';
echo '<th>S_ID</th>';
echo '</tr>';
while($row = $results->fetchArray()) {
echo '<tr>', '<td>', $row["Title"], '</td>',
'<td>', $row["Author"], '</td>',
'<td>', $row["ISBN_number"], '</td>',
'<td>', $row["Copies"], '</td>',
'<td>', $row["S_ID"], '</td>', '</tr>';
}
echo '</table>';
} else {
echo "Error in fetching database";
}
暂无答案!
目前还没有任何答案,快来回答吧!