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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:14:53+00:00 2026-06-05T18:14:53+00:00

I have one table which contains events and dates, and another which contains the

  • 0

I have one table which contains events and dates, and another which contains the guestlist for each of these nights. I can print the nights like so:

$day = date("l");
$date = getFullDateString($day);

$result = mysql_query("SELECT * FROM nights WHERE day = '$day' AND promoter = 'blah'") or die(mysql_error);

while ($row = mysql_fetch_array($result)) {
    echo "<h2>";
    echo $row[name];
    echo " (";
    echo getFullDateString($row[day]);
    echo ")</h2>";
}

The problem is that for each of these events I want the guestlist to be printed below it. I’ve tried putting another while loop inside, but even the test echo doesn’t work.

$result2 = mysql_query("SELECT DISTINCT guest FROM guestlists WHERE night = '$row[name]' AND date = 'getFullDateString($row[day])'") or die(mysql_error ());

    while($row2 = mysql_fetch_array($result2)) {
        echo $row2[0];
        echo "test";
        echo "<br />";
}

Essentially I want the following:

Event 1

Name 1

Name 2

Name 3

Event 2

Name 1

Name 2

Name 3

  • 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-06-05T18:14:55+00:00Added an answer on June 5, 2026 at 6:14 pm

    You have a method inside the query string which won’t be run.

    Try:

    $sql = "SELECT DISTINCT guest FROM guestlists WHERE night = '".$row['name']."' AND `date` = '".getFullDateString($row['day'])."'"
    

    Also, date is a reserved word in MySQL and should be encapsulated within backticks or changed to something else.

    Additionally, the mysql_ functions are being deprecated and it is recommended to replace them with PDO or MySQLi.

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

Sidebar

Related Questions

I have one database table which contains 8 columns. One of the columns is
I currently have a user's table which contains a one-to-one relationship for Youtube OAuth
i have a large mysql database table in which one column contains values ranging
I have a table named events , which contains in-game events such as construction
I have one user table. and second language table which contains language that user
i have one table, which contains that fields mid , email 1 , 'user_a@...'
I have a static Html Table which contains one button Add and when clicking
I have table which contains columns like SiteID (identity_Col) SiteName POrderID Location Address Cluster
I have a table which contains rows, within each row there is a field
There are two tables, which have a relationship(one-to-many). There are Meals table which contains

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.