Thread: Php Mysql
View Single Post
Old 06-23-2007, 05:20 PM   #2 (permalink)
theone_trent
Junior Techie
 
Join Date: Aug 2006
Posts: 56
Default Re: Php Mysql

What you want basically is a search form and the reason behind it is for a hotel buisness wants a program that tells them which room is available for rent? I wouldn't see any reason for a date and time unless you want to include how many days left until a guest has before they are kicked out or will have to pay more for more stays...

Pretty much you will need this basic code to "select" the table. I got the example from here: MySQL Tutorial - Select

<?php
// Make a MySQL Connection
mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());

// Get all the data from the "example" table
$result = mysql_query("SELECT * FROM example")
or die(mysql_error());

echo "<table border='1'>";
echo "<tr> <th>Name</th> <th>Age</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['name'];
echo "</td><td>";
echo $row['age'];
echo "</td></tr>";
}

echo "</table>";
?>
__________________
Acts 10:42 The One Has Come
theone_trent is offline   Reply With Quote