Jump to content

Is this possible?


rogueblade

Recommended Posts

Hey guys I'm building a restaurant reservation system and I'm stuck. I have a data-grid in which I want to print all the restaurants tables that currently exist and display which ones already have a reservation. I don't know how or if it's possible in a MySQL query. In case the restaurant thing is confusing, I'll use a social networking site as an example:

You can query to get all users

You can query to get all users that are your friend

 

I want both of those in one. I want to display all the users but indicate which ones are already my friends.

 

Is this possible in one query?

 

 

Link to comment
https://forums.phpfreaks.com/topic/192853-is-this-possible/
Share on other sites

yes it is possible.

You will also need to factor in dates I imagine but in the table you will have table_ids and date

You then "SELECT * FROM tables;

 

Then in results view you simply put an if statement such as

Run a foreach($row) and within that

 

if (date == today) { //you will change the today to whatever date they are choosing of course
echo 'Booked'; //you might just color the table using css
}else{
echo 'Available';
}

 

I hope this gives the idea.

Link to comment
https://forums.phpfreaks.com/topic/192853-is-this-possible/#findComment-1015818
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.