Bookstore project using XAMPP 详细配置 Part 3
3. Create PHP
1) “Sublime Text” is used as text editor.
2) HTML part of “hello.php” was created as shown. This file is under the directory of “\xampp\htdocs”

3) After being deployed on “localhost:85”, it shows the search boxes as below. Now it’s just the scaffold. We need to add PHP code to realize it.

4) Here comes the tricky part: PHP section. The PHP code should be used to connect to phpMyAdmin database. Also, the PHP code should achieve the search functionality.
I followed the tutorial steps but found it was not working. I got the error message of “Fatal error: Call to undefined function mysql_connect()”. So I did some research and found that all of database command starting with “mysql” such as “mysql_connect”, “mysql_select_db”, “mysql_error” etc were not working in my case. I need to change all of the commands to be started with “mysqli”.
Here, it actually corresponds to the extension setting in “config.inc.php” file in “\xampp\phpMyAdmin” directory, as I mentioned earlier in this report (please see part 1).

I also need to change the “php.ini” file under “\xampp\php” directory. I un-commented “extension_dir=”C:\xampp\php\ext”” (red box in Figure 17). Also I un-commented “extension=php_mysql.dll” and “extension=php_mysqli.dll”


5) After I made all of the changes, the PHP code looks like in the figure below. All of the places of “mysql_” commands were replaced with “mysqli_” shown in line 36, 42, 50, 53, 62, 64.
Also, since “mysqli_” is improved version of “mysql_”, some of the functions will take more parameters than before. I have read the PHP official documentation and made the corresponding changes, e.g., “mysqli_query” will need two parameters instead of 1.
Here are some references related to solving all of the problems I encountered.
a) https://www.youtube.com/watch?v=e3y57I63gCw (the comments are helpful)
b) http://stackoverflow.com/questions/548986/mysql-vs-mysqli-when-using-php
c) http://php.net/manual/en/mysqli.query.php
d) http://php.net/manual/en/mysqli-result.fetch-array.php
e) http://php.net/manual/en/mysqli.error.php
f) http://www.w3schools.com/php/func_mysqli_select_db.asp


6) Finally the interface and search implementation

Bookstore project using XAMPP 详细配置 Part 3的更多相关文章
- Bookstore project using XAMPP 详细配置 Part 1
这是学校的一个project,记录在这里,以备复习.主要是用XAMPP通过phpMyAdmin连接MySQL数据库,实现一个简单的查询功能. Outline Setup of XAMPP Implem ...
- Bookstore project using XAMPP 详细配置 Part 2
2. Implementation of MySQL database in “phpMyAdmin” 1) Create database named “tbl_book” 2) I changed ...
- XAMPP的配置与使用
XAMPP的配置与使用 一.起因 一开始,我在本地手动DIY安装了WAMPP环境,其中经历了很长时间的折腾,原因是独立安装Apache和MySQL,以及PHP的时候,屡次遇到版本兼容问题,我主要的时间 ...
- webpack详细配置解析
阅读本文之前,先看下面这个webpack的配置文件,如果每一项你都懂,那本文能带给你的收获也许就比较有限,你可以快速浏览或直接跳过:如果你和十天前的我一样,对很多选项存在着疑惑,那花一段时间慢慢阅读本 ...
- IntelliJ IDEA详细配置和使用教程-字体、编码和基本设置
IDEA使用--字体.编码和基本设置 https://blog.csdn.net/frankcheng5143/article/details/50779149 IntelliJ IDEA详细配置和使 ...
- 11.IntelliJ IDEA详细配置和使用教程(适用于Java开发人员)
转自:https://blog.csdn.net/chssheng2007/article/details/79638076 前言 正所谓工欲善其事必先利其器,对开发人员而言若想提高编码效率,一款高效 ...
- IntelliJ IDEA详细配置和使用教程(适用于Java开发人员)
关闭Intellij IDEA自动更新在File->Settings->Appearance & Behavior->System Settings->Updates下 ...
- IDEA详细配置+优秀插件
目录 IDEA破解 Settings配置 配置 settings 字体 关闭IDEA更新 设置IDEA打开为项目选择界面 自动导入包配置 显示方法的分割线 滚轮设置字体大小 智能提示忽略大小写 Tab ...
- linux 做gw(nat)详细配置
linux 做企业网关gw(nat)详细配置 最近因为公司的路由器老化导致上网时断时续,上半小时网就断一次网,为此我头疼不已,本着为公司节约成本的宗旨, ...
随机推荐
- flexbox布局
一.侧轴对齐伸缩项目--align-items 它充许调整伸缩项目在侧轴(也就是y轴)的对齐方式,主要包括以下几个值: flex-start/baseline:伸缩项目在侧轴起点边的外边距紧靠住该行在 ...
- 全基因组关联分析(Genome-Wide Association Study,GWAS)流程
全基因组关联分析流程: 一.准备plink文件 1.准备PED文件 PED文件有六列,六列内容如下: Family ID Individual ID Paternal ID Maternal ID S ...
- javascript按中文首字母排序
resultValue=[ '武汉' , '北京' , '上海' , '天津' ] ; resultValue= resultValue.sort( function compareFunction( ...
- Linux下查看IP的命令:ifconfig -a
按照指南实践,在NFS挂载测试和tftp服务器架设时,均需用到本机的IP地址,怎么查看呢? 很简单,键入命令:ifconfig -a 这个命令具体是怎么定义的呢?有时间再查阅,先跑遍指南.
- Microsoft Visual Stduio 2005 Ent安装报错解决方法
错误:Microsoft Visual Studio 2015 Devenv : 安装时发生严重错误 安装过程第一次出现该错误时,查看了日志文件,错误提示如下: [0EEC:0EF0][2016-10 ...
- Oracle 表空间
表空间 编辑 本词条缺少信息栏,补充相关内容使词条更完整,还能快速升级,赶紧来编辑吧! 表空间是数据库的逻辑划分,一个表空间只能属于一个数据库.所有的数据库对象都存放在指定的表空间中.但主要存放的是表 ...
- 匿名函数 lambda表达式(lambda expression)
阅读g2log时,发现有两行代码居然看不懂. 1. auto bg_call = [this, log_directory]() {return pimpl_->backgroundChang ...
- python学习笔记-多进程
multiprocessing from multiprocessing import Process import time def f(name): time.sleep(2) print('he ...
- 谷歌Cartographer学习(1)-快速安装测试
谷歌自己提供了安装方法,但是安装比较繁琐,我做了一定的修改,代码放到个人github上,https://github.com/hitcm/. ros下面的安装非常快捷,只需要catkin_make即可 ...
- java 汉语转拼音(全拼,首字母)
import java.util.*; import net.sourceforge.pinyin4j.PinyinHelper;import net.sourceforge.pinyin4j.for ...