Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,446 members, 7,954,762 topics. Date: Saturday, 21 September 2024 at 08:38 AM |
Nairaland Forum / Science/Technology / Programming / [PHP] Fastest Way To Connect To Your Database And Retrieve Your Values! (1212 Views)
How To Retrieve Deleted Text Messages On Iphone Directly With Ifonemate / Classified DNA Database And Fingerprints website and software / Localhost Not Allowed To Connect To MySQL. Help!!!! (2) (3) (4)
(1) (Reply)
[PHP] Fastest Way To Connect To Your Database And Retrieve Your Values! by moderattor: 7:08am On Apr 12, 2012 |
n this tutorial i will be teaching you how to connect to the database using PHP MySQL. I will assume that you already know a little bit of PHP , a little bit of SQL and have setup your databse and php. I will also assume that you will understand everything i will teach here Of course i will try to make it all as simple as possible, ok? WHAT WE WANT TO ACHIEVE When a user visits our index page, we want to quickly a. connect to the dabase b. retrieve some values c. show it to the user There are many ways to do this, but this is my way. Though i dont code procedural anymore, its OOP all the way. But in this tutorial, its all procedural. PAGES WE NEED 1. index.php // page to contain our form or page we want to display the dynamic content we got from the database. 2. db_connect // page to hook us up to our mysql database. 3. wamp/xampp server configured and running properly 4. our site hosted on wampserver/xampp server Thats all. Got it? Lets rock! First of all run this SQL on your server to create our databse and the required table and fields CREATE DATABASE `testdatabse` ; CREATE TABLE `testdatabse`.`users` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT , `first_name` VARCHAR( 100 ) NOT NULL , `email` VARCHAR( 100 ) NOT NULL ,PRIMARY KEY ( `id` ) ) ENGINE = INNODB for our default values, run this too INSERT INTO `testdatabse`.`users` ( `id` ,`first_name` ,`email` )VALUES ( NULL , 'favour', 'favour@gmail.com' ), ( NULL , 'dave ozoalor', 'daveozoalor@gmail.com' ); The rest>> http://www./169274473187646/doc/205786386203121/ Feel free to Joinn PHP Nigeria on Facebook |
(1) (Reply)
Urgent: I Need A Software To Build A Network Marketing Platform / C: Why Do I Keep Gettng A 'segmentation Fault' Error On C4droid Android App / How To Make OTP System Using Php
(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. 13 |