Computer Forums

Search Tech-Forums.net

Member Login

Remember Me? Sign Up! | Forgot Password
 
 
Reply
Old 06-21-2007, 05:43 AM   #1 (permalink)
jay_bo's Avatar
 
Ultra Techie
Join Date: Jul 2006
Posts: 893
jay_bo is on a distinguished road
Default Php Mysql

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.
jay_bo is offline   Reply With Quote
Old 06-23-2007, 04:20 PM   #2 (permalink)
 
Junior Techie
Join Date: Aug 2006
Posts: 56
theone_trent
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
Old 06-27-2007, 05:41 AM   #3 (permalink)
jay_bo's Avatar
 
Ultra Techie
Join Date: Jul 2006
Posts: 893
jay_bo is on a distinguished road
Default Re: Php Mysql

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.
jay_bo is offline   Reply With Quote
Old 06-27-2007, 03:30 PM   #4 (permalink)
 
Junior Techie
Join Date: Aug 2006
Posts: 56
theone_trent
Default Re: Php Mysql

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
theone_trent is offline   Reply With Quote
Old 06-28-2007, 10:23 AM   #5 (permalink)
jay_bo's Avatar
 
Ultra Techie
Join Date: Jul 2006
Posts: 893
jay_bo is on a distinguished road
Default Re: Php Mysql

so i just drag my mysql database into the server, what about if you dont use a username?
jay_bo is offline   Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



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