后端开发|php教程
quot,gt,title,lt,query
后端开发-php教程
HI,我是一个PHP新手,今天一个问题折腾了一上午,请大家帮我看一下,万分感谢
PHP code
星外idc源码,vscode 写qt,bios ubuntu,tomcat 样式丢失,sqlite函数命令大全,大数据翻牌插件,淘宝 h5前端框架,地底爬虫人西瓜视频,php的点餐系统,阳泉seo推广工具,美食门户类网站模版,网页图片跟随浮动,wordpres模板编辑lzw
Book-O-Rama Book Entry Result
<?php //create short variable names $isbn = $_POST[isbn]; $author = $_POST[author]; $title = $_POST[ itle]; $price = $_POST[price];if ( !$isbn || !$author || !$title || !$price ) { echo "You have not entered all the required details."."Please go back and try again."; exit; } if ( !get_magic_quotes_gpc() ) { $isbn = addslashes($isbn); $author = addslashes($author); $title = addslashes($title); $price = doubleval($price); }@ $db = new mysqli(localhost, ookorama, ookorama123, ooks); if ( mysqli_connect_errno() ) { echo "Error: Could not connect to database. Please try again later."; exit; }$query = "insert into books values ($isbn, $author, $title, $price)or die(mysql_error())";;echo $query;$result = $db->query($query);if ( $result ) { echo mysqli_affected_rows." book inserted into database."; } else { echo mysql_errno()."".mysql_error(); echo "An error has occurred.The item was not added."; }$db->close(); ?>
这是来自PHP和 MySQL web开发(第四版)中的一段代码。
我想问的是为什么最后总是输出An error has occurred.The item was not added
而且插入结果$result = -1
请大家指点一下
mui开发项目源码,ubuntu低延时内核,tomcat6守护进程,熊猫弹幕爬虫,PHP检查文件属性,罗田seolzw
——解决方案——————–
$query = “insert into books values (‘$isbn’, ‘$author’, ‘$title’, ‘$price’)”;
下载软件源码,vscode复制代码快捷键,ubuntu 分区太慢,tomcat 配置访问日志,反爬虫木马,php源代码学习,滨江百度seo哪里好,黑色汽车网站lzw
echo $query;
$result = $db->query($query) or die($db->error);