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)详细配置 最近因为公司的路由器老化导致上网时断时续,上半小时网就断一次网,为此我头疼不已,本着为公司节约成本的宗旨, ...
随机推荐
- C#中常用的几种读取XML文件的方法
1.C#中常用的几种读取XML文件的方法:http://blog.csdn.net/tiemufeng1122/article/details/6723764/
- Git基础知识与常用命令
一:相关概念: 1:工作区(Working Directory): 就是你在电脑里能看到的目录 2:版本库(Repository): 工作区有一个隐藏目录.git,这个不算工作区,而是Git的版本库. ...
- 【转】Linux学习之路--启动VNC服务
我的Linux是Fedora 13,安装方法如下: 1.打开终端,执行 # yum install -y tigervnc tigervnc-server 2.编辑/etc/sysconfi/vncs ...
- xlrd读取多个excel电子表数据
import sys import xlrd import traceback def ReadData(FileName): try: workBook = xlrd.open_workbook(F ...
- Kinect2在线重建(Tracking and Mapping)
前言 个人理解错误的地方还请不吝赐教,转载请标明出处,内容如有改动更新,请看原博:http://www.cnblogs.com/hitcm/ 如有任何问题,feel free to ...
- sublimeText3安装emmet(For Mac)
每次重装st,安装emmet都困难重重,对上一次依照网上查的资料一步步做好了,这次又忘了如何操作,结果又是网上搜索打开一箩筐的网页. 终于决定,把这些惨痛的经历记录下来,要用的话自己看,也可能可以帮助 ...
- 第一章 jQuery基础方法回顾
jQuery即JavaScript,它是一个.js文件(官网下载).使用时须将jQuery库的声明写在HTML文档的head标签里. 章节内容: 1.选择DOM节点 2.延迟的JavaScript的执 ...
- Chrome 插件集推荐
在前端这个行业里面,浏览器担任着及其重要的角色.今天我们可以选择的浏览器有很多,Chrome,Firefox,IE,Safari… 为了能获得更佳的开发体验,大家更多地选择 Chrome.今天介绍下我 ...
- [译]关于iOS和OS X废弃的API你需要知道的一切
原文: Everything You Need to Know about iOS and OS X Deprecated APIs 如你所知,已废弃(Deprecated)的API指的是那些已经过时 ...
- Web API - Video File Streaming
关于C# WEBAPI 视频文件 http://www.codeproject.com/Articles/820146/HTTP-Partial-Content-In-ASP-NET-Web-API- ...