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)详细配置 最近因为公司的路由器老化导致上网时断时续,上半小时网就断一次网,为此我头疼不已,本着为公司节约成本的宗旨, ...
随机推荐
- RedHat 6.7 Enterprise x64环境下使用RHCS部署Oracle 11g R2双机双实例HA
环境 软硬件环境 硬件环境: 浪潮英信服务器NF570M3两台,华为OceanStor 18500存储一台,以太网交换机两台,光纤交换机两台. 软件环境: 操作系统:Redhat Enterpris ...
- 说一说line-height
line-height这个样式相信大家一定不会陌生,我们经常用它来让文本上下居中,这样做一般不出出现什么问题,但是如果对这个属性不是很熟悉的话,可能会踩到一些坑,今天亲自去试验了一下,并总结了一下li ...
- sk_buff封装和解封装网络数据包的过程详解(转载)
http://dog250.blog.51cto.com/2466061/1612791 可以说sk_buff结构体是Linux网络协议栈的核心中的核心,几乎所有的操作都是围绕sk_buff这个结构体 ...
- JVM内存模型和性能优化
JVM内存模型优点 内置基于内存的并发模型: 多线程机制 同步锁Synchronization 大量线程安全型库包支持 基于内存的并发机制,粒度灵活控制,灵活度高于数据库锁. 多核并行计算模 ...
- NetCDF 入门
一.概述 NetCDF全称为network Common Data Format,中文译法为“网络通用数据格式”,对程序员来说,它和zip.jpeg.bmp文件格式类似,都是一种文件格式的标准.ne ...
- SpringMVC 400 Bad Request 问题
摘要 SpringMVC 400 Bad Request 在提交表单时,发生400错误,并未进入save方法. @RequestMapping(value="/!save",met ...
- python的正负无穷float("inf")的用法
今天,在看书的时候看到这么一个例子: 这是用来求解 从某个数字列表中找出俩个彼此最接近但是不相等的数(俩者之间的绝对差是最小的): >>> from random import ra ...
- HMC V7.9.0升级至SP2版本
补丁下载地址:http://www-933.ibm.com/support/fixcentral/ 选择补丁版本 MH01405是和ftp://ftp.software.ibm.com/softwar ...
- SpringMVC 结合HttpClient调用第三方接口实现
使用HttpClient 依赖jar包 1:commons-httpclient-3.0.jar 2:commons-logging-1.1.1.jar 3:commons-codec-1.6.jar ...
- 大前端学习笔记整理【二】CSS视觉格式化模型
1. 概念 在视觉格式化模型中,文档树中的每个元素都将会根据盒模型产生零到多个盒子.这些盒子的布局由如下因素决定: 盒子的尺寸和类型 定位策略(正常文档流,浮动或者绝对定位) 和文档树中其他元素的关系 ...