could anyone post a php code for database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
peacer
Forum Newbie
Posts: 5
Joined: Mon Dec 01, 2003 7:14 pm
Contact:

could anyone post a php code for database

Post by peacer »

hi, could anyone post an simple example on how to connect to database and retrieve data from the database......if can, could u pls, pls, pls, pls help me..... i need it very urgently..........
Last edited by peacer on Tue Dec 02, 2003 12:03 am, edited 1 time in total.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Check out this link:

http://www.php.net/mysql

The manual has a listing of all the PHP functions and what they do. I'd keep it bookmarked and browse around it often to better enhance your learning.

Cheers.
peacer
Forum Newbie
Posts: 5
Joined: Mon Dec 01, 2003 7:14 pm
Contact:

i cant get wad i want

Post by peacer »

the address u gave me is not wad i know, i know is the sample of a dataase connection........
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

you are still going to need to read the manual link that sami posted if you are ever going to learn anything about interaction with mysql...

but here you go anyways :

Code: Select all

mysql_connect ('localhost', 'username', 'password');
mysql_select_db('bob');
$foo = "Select me from table";
$bar = mysql_query($foo);
$row=mysql_fetch_assoc($bar);
echo $row['me'];
Post Reply