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的更多相关文章

  1. Bookstore project using XAMPP 详细配置 Part 1

    这是学校的一个project,记录在这里,以备复习.主要是用XAMPP通过phpMyAdmin连接MySQL数据库,实现一个简单的查询功能. Outline Setup of XAMPP Implem ...

  2. Bookstore project using XAMPP 详细配置 Part 2

    2. Implementation of MySQL database in “phpMyAdmin” 1) Create database named “tbl_book” 2) I changed ...

  3. XAMPP的配置与使用

    XAMPP的配置与使用 一.起因 一开始,我在本地手动DIY安装了WAMPP环境,其中经历了很长时间的折腾,原因是独立安装Apache和MySQL,以及PHP的时候,屡次遇到版本兼容问题,我主要的时间 ...

  4. webpack详细配置解析

    阅读本文之前,先看下面这个webpack的配置文件,如果每一项你都懂,那本文能带给你的收获也许就比较有限,你可以快速浏览或直接跳过:如果你和十天前的我一样,对很多选项存在着疑惑,那花一段时间慢慢阅读本 ...

  5. IntelliJ IDEA详细配置和使用教程-字体、编码和基本设置

    IDEA使用--字体.编码和基本设置 https://blog.csdn.net/frankcheng5143/article/details/50779149 IntelliJ IDEA详细配置和使 ...

  6. 11.IntelliJ IDEA详细配置和使用教程(适用于Java开发人员)

    转自:https://blog.csdn.net/chssheng2007/article/details/79638076 前言 正所谓工欲善其事必先利其器,对开发人员而言若想提高编码效率,一款高效 ...

  7. IntelliJ IDEA详细配置和使用教程(适用于Java开发人员)

    关闭Intellij IDEA自动更新在File->Settings->Appearance & Behavior->System Settings->Updates下 ...

  8. IDEA详细配置+优秀插件

    目录 IDEA破解 Settings配置 配置 settings 字体 关闭IDEA更新 设置IDEA打开为项目选择界面 自动导入包配置 显示方法的分割线 滚轮设置字体大小 智能提示忽略大小写 Tab ...

  9. linux 做gw(nat)详细配置

                          linux 做企业网关gw(nat)详细配置   最近因为公司的路由器老化导致上网时断时续,上半小时网就断一次网,为此我头疼不已,本着为公司节约成本的宗旨, ...

随机推荐

  1. python "yield"(转载)

    转载地址:http://www.ibm.com/developerworks/cn/opensource/os-cn-python-yield/ 您可能听说过,带有 yield 的函数在 Python ...

  2. DBCP数据源连接池实现原理分析

    前些天在调试公司系统的时候发现这样的一个问题:mysql数据库服务停止一段时间后再次重启后吗,tomcat服务无法请求数据库服务,调试了半天对这个问题进行定位解决,期间也搞了很多有关mysql数据库的 ...

  3. ios pod库更新到1.0或1.0.1之正确修改podfile文件

    今天看到cocopods都更新到1.0.1了,之前什么时候更新到的1.0都没发现,刚刚更新一下之后,立马出现了一大堆的错误. 如果没有更新的话,建议不要更新!!!书写麻烦了! 现在记录如何一步一步去除 ...

  4. Oracle Cursor

    1.概念 游标:从字面来理解就是游动的光标.用数据库语言来描述,游标是映射在结果集中一行数据上的位置实体,有了游标,用户就可以访问结果集中的任意一行数据了.将游标放置到某行后,即可对该行数据进行操作, ...

  5. vs2010 A selected drive is no longer valid

    visual studio 2010重新安装添加组件,报A selected drive is no longer valid错误. 这个是由于已经安装了sp1,此时需要将sp1卸载掉,然后就可以安装 ...

  6. Xocde4与Xcode3的模板比较

    XCode 4.2.1 项目的模版截图: Single View Application This template provides a starting point for an applicat ...

  7. UIView中间透明周围半透明(四种方法)

    方法一 #import "DrawView.h" @implementation DrawView - (instancetype)initWithFrame:(CGRect)fr ...

  8. MySQL安装之后没有MySQL数据库的原因

    mysql安装完之后,登陆后发现只有两个数据库:mysql> show databases;+--------------------+| Database           |+------ ...

  9. 20151210study

    -----------------------------------------------------The election officials were not neutral.选举官员并不是 ...

  10. net软件自动生成开发编程框架编程机器人

    有一个.net自动生成平台(编程机器人)推荐给大家,常规几天十几天的工作,机器人几分钟搞定,不写一行代码,留下大把休闲时光,适应于聪明人:不想太累的程序员(看看风景泡泡妞),不想多请人的老板(有限资金 ...