Computers |
|
| | #1 (permalink) |
| Ultra Techie Join Date: Jul 2006
Posts: 878
| hi i have created a mysql table database and i wanted to inclucde it into my site. what i want to do is create a form to search the database. Can anyone help me do it, i need help linking the database to the site. What i want to do is they do fill in a form when they want to come and stay at the hotel and then it comes up with what rooms are availble, but if i did it in mysql wont there be loads of dates and time consuming in doing it. thanks, Also could i use Ms Access instead of My sql which one would be better Last edited by jay_bo; 06-21-2007 at 05:58 AM. |
| | |
| | #2 (permalink) |
| Junior Techie Join Date: Aug 2006
Posts: 56
| 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 |
| | |
| | #3 (permalink) |
| Ultra Techie Join Date: Jul 2006
Posts: 878
| i have more than 1 problem. My database is password procted so wont i need to include it in that text. And i mean say todays date is the 27 june 2007 a i wanted to see if i could get a room fr 20 december 07 they will have to be loads of date up to december. |
| | |
| | #4 (permalink) |
| Junior Techie Join Date: Aug 2006
Posts: 56
| Sorry. I should have explained the connection part. In the mysql_connect() your password goes in the third section: mysql_connect("localhost", "login name", "password") or die(mysql_error()); In the section here you specify which database to use. mysql_select_db("database name") or die(mysql_error()); As far as the dates and such, I'm not too sure. I've started learning php, but then I started learning flash. My best suggestion is to find a tutorials site, or even better go to a Barnes & Noble and find you a book for php & mysql, read through it and you should get your answer.
__________________ Acts 10:42 The One Has Come |
| | |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need a good captcha generating php script | surut | Windows Operating Systems and Software | 1 | 05-26-2007 08:23 AM |
| PHP captcha script needed | iorgus | Programming Discussions | 2 | 05-20-2007 12:33 PM |
| MYSQL UPDATE query syntax | selina | Programming Discussions | 1 | 05-09-2007 11:50 PM |
| PHP 2-player game? | thejeremy | Programming Discussions | 4 | 04-09-2007 05:01 PM |
| Remote file access w/ IP + PHP? | thejeremy | Programming Discussions | 2 | 04-04-2007 04:24 PM |