• Notice regarding image hosts and attachments. See here.

Getting values from MySQL Database

Associate
Joined
24 Sep 2005
Posts
209
Would anyone be able to show me how to pull values from a MySQL Database, using PHP?

There is a table equipmentbooked with the fields: BookingID, ItemID, Week, Day, Period.

I need to construct a table in PHP, for say Mondays bookings, with either the values obtained from the database, or "Available" if there is no bookings made.

-------
$equipmentbookings = @mysql_query( "SELECT * FROM equipmentbooked WHERE (ItemID = $id)");
if ($equipmentbookings) {

while ($equipmentbooking = mysql_fetch_assoc($equipmentbookings)) {

$ItemID = $equipmentbooking['ItemID'];

----
my problem arises here - how can I retrieve bookings made for Week1, Day Monday, Period 1-10?

Thanks for any help

Steven
 
Basically you want a query something like:

SELECT * FROM equipmentbooked WHERE Week = 1 AND Day = 'Monday' AND Period >= 1 AND Period <=10

Not sure if you want anymore than that?
 
Back
Top Bottom