Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,148,356 members, 7,800,715 topics. Date: Thursday, 18 April 2024 at 02:47 AM

Simple CRUD Application In PHP And Mysql – Part 2 - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Simple CRUD Application In PHP And Mysql – Part 2 (530 Views)

Adsense Click Exchange Group / Simple CRUD Application In PHP And Mysql – Part 3 / Simple CRUD Application In PHP And Mysql (2) (3) (4)

(1) (Reply)

Simple CRUD Application In PHP And Mysql – Part 2 by maekhel(m): 9:57am On Mar 09, 2015
Welcome guys, this is the second part of the Simple CRUD Application In PHP and MySQL series. In the first part of the tutorial series, I did an overview of the application we will be developing. In this part, we will be setting up our working environment and also create our database. Lets begin.
Setting Up Working Environment
This tutorial assumes you already have a local server (LAMP, WAMP, MAMP etc) installed and configured on your computer. You will also need a text editor (like notepad++, sublime text etc) for writing your codes. In my case am using Sublime Text 3. Got all this in place, now we setup our working directory and folder structures. In your root folder (usually “www folder” or “htdocs folder”), create a new folder and name it CRUD. This folder will be the parent folder for our application. It will contain all other folders and files. Now create another folder inside the CRUD folder called db. The db folder will hold our file that connect to our database. Inside the db folder, create a PHP file and name it connect.php. Now navigate back to the parent folder (CRUD folder) and create the following files: index.php, create.php, edit.php, view.php, delete.php and styles.css. You should a directory structure similar to below:

Having gotten the working environment and directory structure setup. Its time to create our database and table.
Creating Our Database and Table Structures
Our database name will be called crud and it will contain a single table called staff. The staff table will have 4 fields/columns. The columns will include an id, name, position, joined and bio. The id field will be an auto-increment INT field and will be the primary key. The name and position will be a VARCHAR field that will hold the name and position of staff respectively. The joined field is a DATETIME field that will hold the date and time the staff joined. And lastly the bio field will be a TEXT field that hold bio-data of the staff.
Open your MySQL client (PHPMyAdmin in my case) and create a database called crud and create a table called staff with the fields above. You should have a structure as below:

Here is the SQL code to create the table:
CREATE TABLE staff (
id INT(11) AUTO_INCREMENT,
name VARCHAR(50),
position VARCHAR(50),
joined DATETIME,
bio TEXT,
PRIMARY KEY (id)
);
In the next part of this Simple CRUD Application In PHP And MySQL series, we will start the actual coding our CRUD application.
Don’t wanna miss the next tutorial? then subscribe to our newsletter to get tutorial update directly in your mail box. See you in the next part. .
Your views, comments, suggestions and questions counts, drop them in the comment form below
Subscribe to our newsletter and join subscribers who are already receiving blog updates directly in their mail box.
source: http://tutorialslodge.com/simple-crud-application-in-php-and-mysql-part-2/
Re: Simple CRUD Application In PHP And Mysql – Part 2 by Tectono: 3:58am On Mar 14, 2015
Have you visited this very popular site that reviews daily business activities in Nigeria? It is called Tectono Business Review. You can check it out: http://tectono..com/

(1) (Reply)

Let Me Animate Your Website Logo / How You Can Effectively Make Money Using Google Adsense / Help, My Blog Is Loadin Very Slow

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 14
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.