How To Create A PHP Front-End To Your MySQL Database Using DaDaBIK
Sure, all PHP developers have used PHPMyAdmin, but have you heard of DaDaBIK? In this article Eugenio talks about DaDaBIK and shows us how to use it to create a front-end for a MySQL database with it in under 5 minutes.
How To Create A PHP Front-End To Your MySQL Database Using DaDaBIK - Database Table Creation (Page 2 of 5 )
I want to start immediately with a simple example: imagine that we need to manage a database that contains the information of a group of people (e.g. the customers of a company) via a web page; the database (contacts_db) contains just one table (customers_tab), which includes the following fields:
ID_cust An auto: incrementing numeric field. Primary key of the table first_name_cust: the first name of the customer last_name_cust: the last name country_cust: the country phone_cust: the phone number email_cust: the e-mail address web_cust: the address of the web site age_cust: the age job_cust: the job type notes_cust: additional notes about the customer update_date_cust: the date on which the information about this customer was last modified
Here's the SQL statement you can use to create the table:
CREATE TABLE `customers_tab` ( `ID_cust` SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY, `first_name_cust` CHAR(50) NOT NULL, `last_name_cust` CHAR(50) NOT NULL, `country_cust` CHAR(50) NOT NULL, `phone_cust` CHAR(20) NOT NULL, `email_cust` CHAR(50) NOT NULL, `web_cust` CHAR(100) NOT NULL, `age_cust` CHAR(3) NOT NULL, `job_cust` CHAR(50) NOT NULL, `notes_cust` TEXT NOT NULL, `update_date_cust` DATE DEFAULT '2002-08-31' NOT NULL );
And, if you're very lazy then here are the insert statements you can use in order to insert some sample records:
INSERT INTO customers_tab VALUES (1, 'John', 'Smith', 'USA', '+1 555-123456-487-89', 'john@smith.com', 'http://www.john.com/', '36', 'Teacher', 'This is our best customer.', '2002-08-31');
Installation + Use Of DaDaBIK Create a new directory under the root of your web server called my_dadabik.
Download DaDaBIK from http://www.dadabik.org/ and unzip the zip file; it includes some documentation files together with a folder called program_files; just copy the contents of that folder into your my_dadabikdirectory that you have just created.
Now, open the file config.php file in the include folder with a plain text editor (e.g. Notepad on a Windows system or vi on Unix) and specify your database access parameters; for example, if MySQL runs on your local machine and you can access your database contacts_db with the user root and password mypass, your configuration file will start something like this:
You are now ready to install DaDaBIK. Run the install.php script from your browser (http://localhost/my_dadabik/install.php) and click on the install button. If the installation procedure has completed successfully then you should see some confirmation messages.
That's all there is to it! You are ready to manage your tables via the web -- just point your browser to: http://localhost/my_dadabik/index.php if you installed DaDaBIK on your local PC.