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)详细配置 最近因为公司的路由器老化导致上网时断时续,上半小时网就断一次网,为此我头疼不已,本着为公司节约成本的宗旨, ...
随机推荐
- php js 排序
编写背景及排序 规则 公司需要对游戏进行一系列的排序,在这里只说我自己遇到问题的哪一段 //规则:$plat数据要根据$sort里的sort为相应 可以输入一个数字,即为该平台: 解决思路:将$so ...
- AndroidStudio关联svn并上传代码到svn服务器上
打开AndroidStudio,按Ctrl+Shif+S快捷键,进入Settings设置页面.如上图所示,找到Version Control->点击Subversion->右边框口中勾选U ...
- 第1周 支路变量、元件、KCL和KVL
第1周的内容,介绍了: 电阻.独立源.受控元件等实体元器件, 电流.电压.功率等抽象名词, 端口.参考方向等分析时的概念工具, KCL.KVL两大分析定律, 解线性电路的普适方法----2B法. 引入 ...
- 小tip:CSS vw让overflow:auto页面滚动条出现时不跳动
原文地址:http://www.zhangxinxu.com/wordpress/?p=4552 一.水平居中布局与滚动条跳动的千年难题 当前web届,绝大多数的页面间布局都是水平居中布局,主体定个宽 ...
- HR开发 获取信息类型数据
1.PNP逻辑数据库. LOOP获取信息类型数据. TABLES: PERNR . , . START-OF-SELECTION. GET PERNR . LOOP AT P0000 WHERE .. ...
- NES模拟器开发-PPU笔记
20151008 占坑,暂时没弄清楚PPU数据如何初始化,绘制顺序等.
- shell 环境初始化顺序
登陆shell 的执行顺序 /etc/profile /etc/profile.d/file /etc/bashrc .bashrc .bash_profile 非登录shell 的执行顺序, 例如: ...
- C语言实现 字符串过滤并修改并返回个数
基本问题:给定一个strContent,strWord,使用strWord 匹配strContent,匹配成功,将匹配部分全部替换为‘*’ ,并返回匹配成功个数.注意不能使用库函数. 例如:strCo ...
- spring 事务:注解方式
(1) .<context:component-scan base-package="*.*" /> 该配置隐式注册了多个对注解进行解析的处理器,如: Autowire ...
- ajax select option 数据。为了下次方便信手拈来!!
为了下次方便信手拈来!! 示例1 var form = document.forms["maddraddform"]; $(form.province).change(functi ...