Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.