Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 676169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:53:55+00:00 2026-05-14T00:53:55+00:00

While looking for a way to temporarily save the search results when a user

  • 0

While looking for a way to temporarily save the search results when a user searches for a hotel free between particular dates i came across temporary tables.

But certain questions are not answered even in mysql manual…. like…

  1. Will the temporary table be unique for each user that executes the script…? Or will it be overwritten when two different users run the script at the same time…?

  2. When will the table be destroyed..? When the user closes the browser window or just navigates away from the page in which the script runs…?

Thanks for your clarifications…

This is how i do it….

$table = "CREATE OR REPLACE TEMPORARY TABLE $free_room(
              room_id INT(5),
              room_name VARCHAR(150),
              max_persons INT(1),
              rooms_free INT(1),
              room_price INT(6),
              hotel_id INT(4),
              hotel_name VARCHAR(100),
              hotel_stars INT(1),
              hotel_type INT(1)) ENGINE=MEMORY";

    $query_getFreeRooms = "INSERT INTO  $free_room
                           SELECT $rooms.room_id,
                                  $rooms.room_name,
                                  $rooms.max_persons,
                                  $rooms.total_rooms - $rooms.booked_rooms AS rooms_free,
                                  $rooms.room_price,
                                  $hotels.hotel_id,
                                  $hotels.hotel_name,
                                  $hotels.hotel_stars,
                                  $hotels.hotel_type
                           FROM   $hotels,$rooms
                           WHERE  $rooms.room_id NOT IN (SELECT room_id
                                                         FROM   $reservations
                                                         WHERE  $dateCheck)
                           AND    $hotels.hotel_city = '$city_search1'
                           AND    $hotels.hotel_id = $rooms.hotel_id
                           AND    $hotels.hotel_deleted = '0'
                           AND    $rooms.room_deleted = '0'";
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:53:55+00:00Added an answer on May 14, 2026 at 12:53 am

    Quoting the MySQL manual page of CREATE TABLE :

    You can use the TEMPORARY keyword when
    creating a table.
    A TEMPORARY table is
    visible only to the current
    connection, and is dropped
    automatically when the connection is
    closed
    .
    This means that two different
    connections can use the same temporary
    table name without conflicting with
    each other
    or with an existing
    non-TEMPORARY table of the same name.

    Considering that two users will have two distinct connections, the table will be unique for each user.

    The temporary table will be dropped when the connection that created it is closed — in PHP, at least, it means when the script that generates the page ends (So, generally, even before the users actually reads the page)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While looking for the best way to search an array of objects in Javascript
I'm looking for a way to easily save the browsing history of the user
i looking for a way to preview the text while im typing in a
I am looking for a way to translate mouse movements - while the left
I'm looking for a easy way to post data to webpages while keeping the
I've been looking for a while and want a way to sort a Javascript
I'm looking for the easiest possible way to hide an UpdatePanel while waiting for
While looking for a light-weight Scala development environment, I came upon an Scala edit
I'm looking for a way to access a POP3 account while running a JUnit
I'm looking for a way to easily wrap security around a location, while at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.