Hi

Busy putting together my first competent attempt at a PHP/MySQL website, its a real estate package of sorts. I'd like to bring up a brief description of each house (in the DB) initially and when the user clicks on the photo or name etc, they will be directed to a new page with all of the details available...
as such, i guess i need to send some sort of data, the houseID (which I have created for each house uniquely), so that the new page can pull out all of the appropriate info from the DB using that houseID as a key...

Can anyone point me in the direction of some code to make this happen?

REALLY APPRECIATE IT!!
lifeworks

Its pretty easy. In page 1, say, you are listing all the houses with hyperlinks. Eg.

$query="select id from houses";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
echo "<a href=houseinfo.php?id=".$row['id'];
}

In houseinfo.php, you just have to get the id from the url, fetch its information from the table and print it.

<?php //houseinfo.php
$id=$_GET['id'];
$query="select * from houses where id = '$id'";
$result=mysql_query($query);
$row=mysql_fetch_array($result);
print "Address : ". $row['address'];
print "Cost: ". $row['cost'];
...

Thats bout it..

Thanks very much nav33n, saved me a lot of reading there!

lworks

you are welcome :)

hi
i have a problem i need the same thing pop up a windoow when user clicks the link
hear is my code plz tell me if i made a mistake

<html>
<head>
</head>
<body>
<?
$company= $_REQUEST['companytype'];
$companytype =mysql_real_escape_string($company);
echo "<h1> <font color=green>Results For $companytype</font></h1>";
$query  = "SELECT companyname,companytype,address,kommun,postcode,telephone
           FROM addreg where companytype  ='$companytype' ORDER BY id desc  limit 0,5";
		   $result = mysql_query($query);
echo mysql_error();
echo "<table width='100%' border='0'>";


while($row = mysql_fetch_array($result))
{
	echo "Companytype :"."<a href= 'houseinfo.php?companytype=".$row["companytype"]."'></a>". "<br>";
	echo "Companyname : " .$row['companyname'] . '<br>';
	echo "Address     : " .$row['address'] . '<br>';
	echo "Telephone   : " .$row['telephone'] . '<br>';
	echo "<img src='img/divv.jpg'>"."<br>";
}
echo '<br>';
	?>
    </body>
    </html>

when the user clicks the 'companyname' a window should pop out showing the details ,but i dont output anything can some one help.

that i understood but my main problem is the code i have does not display any hyperlink on the iem i want and if i do some chage to it ih making the whole result hyperlink,even if i click the click no items are displayed in the pop

Umm.. I dont understand.. You want companyname to be a hyperlink, but here you have it for companytype ?

i have it on companyname but when o out put it get like this i want hyper link n hotel and address so when i click on hotel or address it should open a window and rest of the details along with image shold be displayed:
1)i dont get the hyperlink on hotel
2)even if i make ajustments in the code i get hyperlink on all of the out out
3)when i click the link i dont see the output that i want to see in the pop up window
this is my output:
Companytype: Hotell
Companyname: hello
Address: 76 lin
Telephone: 987-098654

Companytype: Hotell
Companyname: hello
Address: 76 lin
Telephone: 908-987654

Companytype: Hotell
Companyname: hello
Address: 76 lin
Telephone: 908-987654

Companytype: Hotell
Companyname: hello
Address: 76 lin
Telephone: 908-987654

its working fine thnk you for help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.