PhpED: PHP IDE
new features
features
version comparison
features: php tools
php debugger
php profiler
php frameworks
php scripts
features tour
licensing
php testing
PhpED difference
PhpED on Mac/Linux
testimonials
PhpDock
Nu-Coder
PhpExpress
TechPlatform

PHP Database Scripts by NuSphere

PHP Database scripts presented here are generated by NuSphere DB-Form Wizard in NuSphere PhpED (PHP IDE).
This particular set of scripts provides the form that can be used to browse, insert, update and delete the data records in MySQL server table "items". Table "items" belongs to the database "shopcart" and has the following fields:
  • Itemno - [char] (4) NOT NULL,
  • Description - [varchar] (30),
  • offered_by - [char] (3),
  • start_date - [date],
  • end_date - [date],
  • reserve_price - [decimal]
PHP DATABASE SCRIPTS

How are PHP Database scripts generated

PhpED's Db-Form Wizard substitutes macros in the templates provided by the user and generates PHP code working with the database. While templates mechanism in DB-Form wizard is pretty generic, it is most commonly used to generate two sets of scripts:

  • front end script to display PHP/HTML Form to post the requests to the database
  • back end script to process DB requests

In this example NuSphere PHP Database scripts are using Ajax requests to submit DB queries. The following is the brief description of the PHP Scripts used in this example:

  • ajax_db_form.php - generates Ajax based HTML form to browse, insert, update and delete the data records in "items". Gemration of Ajax request is implemented in Javascript functions getAjaxRequest(),ajaxFunctionDelete() and ajaxFunctionForm()
  • table_items.php - handles Ajax requests to process DB queries on the back end.
  • config.inc.php - contains db connection settings
  • db_utils.inc - implements PHP Class dbconn and several DB utilities
  • db_interbase.inc, db_mssql.inc, db_mysql.inc, db_oracle.inc, db_postgres.inc, db_sqlite.inc - implement database specific queries. File db_ mysql.inc is used in this particular example to connect with MySQL database server.

See PHP Database Ajax for more details on the implementation of these scripts.

How to use PHP Database scripts

  • Download zip archive of NuSphere PHP Database scripts.
  • Extract the files to the destination directory
  • Make sure that MySQL extension is loaded
  • Create database "shopcart" - you can run db commands in NuSphere's PHP Database Connection Client. To create the database in MySQL run "create database shopcart".
  • Create the table and insert some items into it:
CREATE TABLE `items` (
  `Itemno` varchar(4) NOT NULL,
  `Description` varchar(30) NOT NULL default '',
  `offered_by` varchar(4) NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `reserve_price` decimal NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8

insert into items
  values(1001,'Red Bicycle','U01',
  '2002-02-05','2002-02-20',40);
insert into items
  values(1002,'Motorcycle','U02',
  '2002-03-11','2002-04-15',500);
insert into items
  values(1003,'Old Bicycle','U02',
  '2002-02-10','2002-03-20',25);
insert into items
  values(1004,'Tricycle','U01',
  '2002-03-25','2002-04-08',15);
insert into items
  values(1005,'Tennis Racket','U03',
  '2002-04-19','2002-05-30',20);
insert into items
  values(1006,'Helicopter','U03',
  '2002-06-05','2002-06-25',50000);
insert into items
  values(1007,'Racing Bicycle','U04',
  '2002-02-20','2002-03-20',200);
insert into items
  values(1008,'Broken Bicycle','U01',
  '2002-03-05','2002-04-06',25);
  • Update confi.inc.php with your database connection/authentication settings
  • Execute ajax_db_form.php. You can run it in PhpED PHP Viewer.

You can manually edit and modify ajax_db_form.php, table_items.php and config.inc.php to work with any other database and tables.

Learn more about generating PHP Database using NuSphere DB-Form Wizard and take a look at other PHP Tools and PHP Scripts provided by NuSphere PhpED - PHP IDE

Download zip archive of NuSphere PHP Database scripts here

 Download NuSphere PHP IDE

Download a free trial of the fast PHP EDitor and robust Integrated Development Environment for PHP.

 Buy NuSphere PhpED® now

Best PHP Editor and complete PHP IDE.
NuSphere PhpED 20.0 is available from our online store front.

 Special Team4 Offer

Get 4 copies of PhpED for the price of 3!

Optimum solution for development teams.
PhpED 20.0 Team4
Need more than 4 licenses? Contact Us for more quantity discounts, please use "Ordering/Payment issue" subject on the form.

 Dr. Dobb's

Dr. Dobb's

Dr. Dobb's Magazine covers NuSphere PhpED in New and Noteworthy section.

 InfoWorld

infoworld.com
PhpED is a proper, world-class IDE for PHP code. It is the only IDE worth considering if PHP development is your primary job