hi guys! wondering if somone can help me here!
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 box has all the property nos that are being retrieved from the database. now the combo box should allow the user to select the property no and display its details on the webpage such as 'no of rooms' 'owner' etc. 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, does a query and retrieves data into the combo box:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
// connect to mySql
$session = mysql_connect("localhost", "root", ""
;
// select the database
mysql_select_db("dreamhome"
;
$query = "select * from property_for_rent";
$result = mysql_query($query);
if ( !$result )
{
echo ( "<P>Error doing a select: " . mysql_error() . "</P>" );
}
else
{
// succesful read - how many records ?
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);
?>
//puts the property nos into the combo box
<form name="form1" method="post" action="">
<select name="getPropNo" id="getPropNo">
<?php
for ($i=0; $i<$rr; $i++) {
$nextresult = mysql_fetch_array($result);
$property_no = $nextresult['property_no'];
echo "<option>$property_no</option>";
}
?>
</select>
</form>
<p> </p>
<p> </p>
</body>
</html>
thank you so much