Forums

PHP

This topic is locked

display database data

Posted 29 Nov 2006 03:03:34
1
has voted
29 Nov 2006 03:03:34 Alexis Lalas posted:
hello to all.

i have a doubt and i hope you guys can help me out.

im kind of new with php and dreamweaver and ive managed to get a "system" running with insters, updates & delets. also i can get some basic queries and get information from the database.

ive seen aroun in other webpages that they have a url that could look like www.whatever.com/example.php?fred=this&wilma=that and so on.

how can i get that working with dreamweaver? also, how can i use only 1 php file to display different queries.

lets say i have a database with name, phone, email, books, cds, movies, sports.

how can i get the name of the person and the book in the same php file in which i would also like to get the name and the cd, the name and the movie and the name and the sports, each seperately.

thanks and hope somebody helps me clear my mind.

have a nice day, God bless.

Replies

Replied 12 Dec 2006 10:00:08
12 Dec 2006 10:00:08 Brijesh Srivastava replied:
Hi Alexis,

Well I think u can do it in the same manner as u select for the name and corressponding book he has taken.

Or you want some thing else plz. clear.

If you have one database with different table (eg name,phone,email,cd,movies,sports)

then you have to look for the Main table i.e. Name. with this id of this Name you can go for the different table.

and

if you have only one table which contain name,phone,email,cd,movies,sports then it is very easy.

you have to write:

$query="select * form <Table Name> where <Condition>";
$res=mysql_query($query);
$row=mysql_fetch_object($res);

$NAME=$row->name;
$PHONE=$row->phone;
$EMAIL=$row->email;
$CD=$row->cd;
$MOVIE=$row->movie;
$SPORT=$row->sport;


with this query you get the name,phone,email,cd,movies,sports.but this is only for one table.

Reply to this topic