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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:54:18+00:00 2026-06-12T21:54:18+00:00

PDO is not displaying any data could somebody help me out: $ClanData_users = sql::db()->prepare(‘SELECT

  • 0

PDO is not displaying any data could somebody help me out:

$ClanData_users = sql::db()->prepare('SELECT * FROM clan_game INNER JOIN clan_page ON clan_game.clan_home = clan_page.id ORDER BY clan_game.date ASC');
$ClanData_users->execute();
$q = ($ClanData_users);

$content .= '<table class="forum"><tbody><tr class="bericht-content"><td> Kalender</td></tr>';
while($r = $q->fetch()){
    $content .= '<tr><td><span class="beschrijving"><p> '.$r['clan_game.clan_home'].' '.$r['clan_challenger'].' '.ucfirst(strftime("%A %H <b>%B</b> %Y | %R", strtotime($r['date']))).'  </p></span></td></tr> ';
}
$content .= '</tbody></table>';
  • 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-12T21:54:19+00:00Added an answer on June 12, 2026 at 9:54 pm

    It usually isn’t a good idea to SELECT * in a JOIN query. Instead, be specific about the columns you need, and assign aliases to them when the names overlap. You cannot access them with the table name via $r['table_name.column_name'] after fetching. The associative columns will only be available in $r['column_name'] by the column name or alias, so all column names/aliases must be unique.

    $ClanData_users = sql::db()->prepare('
      SELECT 
        /* If both tables have the same column name, use an alias */
        clan_game.id AS clan_game_id,
        clan_home.id AS clan_home_id,
        clan_game.clan_home AS clan_home,
        clan_challenger,
        /* etc... Be specific and alias as necessary */
      FROM clan_game 
        INNER JOIN clan_page ON clan_game.clan_home = clan_page.id
      ORDER BY clan_game.date ASC');
    

    When fetching, use only the column name or alias

    // Why reference $ClanData_users as $q here? That's confusing. Just fetch from $ClanData_users
    while($r = $ClanData_users->fetch(PDO::FETCH_ASSOC)){
        $content .= '<tr><td><span class="beschrijving"><p> '.$r['clan_home'].' '.$r['clan_challenger'].' '.ucfirst(strftime("%A %H <b>%B</b> %Y | %R", strtotime($r['date']))).'  </p></span></td></tr> ';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can anyone tell me what could cause this error Fatal error: Class PDO not
Are PHP/mysql prepared statements possible when mysqli and PDO are not available? Are there
Im trying to get the mysql_insert_id using PDO. Thus far i've not found a
I have a pdo connection with ODBC (v2000.86.359.00) connecting to an SQL Server (v8.00.2039
Different databases have slight variations in their implementations of SQL. Does PDO handle this?
One of my hosting server does not support PDO. Are there and mysql_ commands
I want to use PDO but I'm not sure whether my hosting has set
I have a VARCHAR(4) column that receives data from an input that may be
Prepared statements are good to prevent sql injection when the user supplies data and
Trying to get to hang of PDO but not having much fun at the

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.