database driven webpage-please please help
Posted: Sun Feb 19, 2006 4:56 am
Pimptastic | Please use
the details that need to be shown on combo box user selection of property no are
thank you so much.
Pimptastic | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
hi guys! I'm a newbie. so wondering if someone could help me.
basically I've a dreamhome database which has details on the properties on rent. I've a webpage that connects to the database and it has a combo box. The combo box shows all the property nos that are being retrieved from the database using the while loop. now the combo box should allow the user to select the property no and display the other details of that property on the webpage such as 'no of rooms' 'owner' etc that is in the database. I can't figure out how to do it? can someone help me
this is the code I'm using which connects to the database, do a query and retrieves data into the combo box:Code: Select all
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
// connect to mySql
if (!$session = @mysql_connect("localhost", "root", "")) {
print ('Error: Could not connect to database server.<br>');
break;
}
// select the database
if (!@mysql_select_db("dreamhome")) {
print ('Error: Could not secect database.<br>');
break;
}
$query = "select * from property_for_rent";
if (!$result = @mysql_query($query)) {
( "<P>Error doing a select: " . mysql_error() . "</P>" );
break;
} else {
print (" Number of rows read " . mysql_num_rows($result)."</br>");
$rr = mysql_num_rows($result); //this is calculating the number of rows read from database and puts it into variable rr
}
// close the connection
mysql_close($session);
?>
<form name="form1" method="post" action="">
<select name="getPropNo" id="getPropNo">
<?php
//puts the property nos into the combo box from the database
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
print ("<option>" . $row['property_no'] . "</option>\n");
}
?>
</select>
</form>
<p> </p>
<p> </p>
</body>
</html>Code: Select all
type________rooms_______ owner no_____________________
Rent___________________ Person/business name _____________
Address_________________ Address___________________________
Tel no_____________________________
Type of business____________________
Contact name_______________________
Managed by staff____________ Registered at branch _________________Pimptastic | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]