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 4017924
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:55:13+00:00 2026-05-20T09:55:13+00:00

I have two tables that I want to use for viewing my reports which

  • 0

I have two tables that I want to use for viewing my reports which I can get after inputting a date.

Here are my tables: for customers – customer_date, lastname, firstname

for services – room_number, date_in, date_out

Here is my code now : it seems that it can’t get any rows from my table

<?php 

$conn = mysql_connect("localhost","root","");

mysql_select_db('irm',$conn);

if(isset($_GET['Submit'])){

$customer_date = $_GET['customer_date'];
}

?>
<form method="get">
<table width="252" border="0">
  <tr>
    <td width="98">Choose Date:</td>
    <td width="144"><label>
  <input onclick="ds_sh(this);" name="customer_date" id="customer_date" readonly="readonly" style="cursor: text" />
</label></td>
 </tr>
 <tr>
<td align="right"><input type="submit" value="Submit" /></a></td>
<td></td>
</tr>
</table>
</form>  

<form>
<?php

    $tryshow = "SELECT * FROM customers,services WHERE customer_date = '$customer_date' ";

    $result = @mysql_query($tryshow,$conn)
            or die("cannot view error query"); 

    if (mysql_num_rows($result) == 0) {
    echo "No rows found, nothing to print...";
}
while($row=mysql_fetch_assoc($result)){
?>
<table width="700" border="0">
    <tr>
      <td width="100">Customer Date:</td>
      <td width="100">Last Name</td>
      <td width="100">First Name</td>
      <td width="100">Room Number</td>
      <td width="100">Date In</td>
      <td width="100">Date Out</td>
    </tr>
    <tr>
      <td><?php echo $row["customer_date"]; ?></td>
      <td><?php echo $row['lastname']; ?></td>
      <td><?php echo $row['firstname']; ?></td>
      <td><?php echo $row['room_number']; ?></td>
      <td><?php echo $row['date_in']; ?></td>
      <td><?php echo $row['date_out']; ?></td>
   </tr>
  </table>
<?php }?>
</form>

With this I can get a report of any customer who checks in on that date.

I need some advice. Hope you can answer me soon.

  • 1 1 Answer
  • 3 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-20T09:55:13+00:00Added an answer on May 20, 2026 at 9:55 am

    You need to relate the two tables with a JOIN. Based on the information given, customers.customer_date to services.date_in seems to be the most likely candidate. This assumes that the date columns hold only a date and not a date/time.

    Also notice that I’m not using select * in my query and neither should you. 😉

    SELECT c.customer_date, c.lastname, c.firstname,
           s.room_number, s.date_in, s.date_out
        FROM customers c
            INNER JOIN services s
                ON c.customer_date = s.date_in
        WHERE c.customer_date = '$customer_date' 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables that I want to use in my query, tblEmployee and
I have two tables that I want to join into one table and use
I have two tables that I want to join together. Table1 Year, ID, Theme,
If i have two tables that have nothing in common I want to do
I have two tables and I want to display only the child ID that
I want to delete multiple records at once. I have two tables, one that
I have two tables that I need to join... I want to join table1
I have two tables and I want to use the database to enforce a
I have two tables. Both contains question id field. I want to get all
I have a situation where I want to connect two tables that do not

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.