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

  • Home
  • SEARCH
  • 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 7052259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:21:43+00:00 2026-05-28T03:21:43+00:00

I have the following code to perform a dynamic query of JOINED tables but

  • 0

I have the following code to perform a dynamic query of JOINED tables but for some reason, whenever I try to display the row, it only displays up the first 9 rows then stops.

$query = "SELECT `results`, `Success`, `Failure`, `Counter`, `Grades`, `Classes`,
`Special_Id`, `SpecialCondition` FROM `Courses` INNER JOIN `Students` ON `id` = 
`Students_Id`";

And this is how I’m fetching the rows and displaying them:

<?php
foreach($results as $row){
echo $row['grades'].'<br />';
}

I tested the JOIN SQL syntax in phpMyAdmin and while it returns as a positive task, I notice that it only shows the original table and not the joined table after being joined.

Any suggestions on where i’m going wrong here? I’m only showing this portion of the code because everything works fine, and when I remove the JOIN syntax it works beautifully, so I’m lead to believe the joining is causing the issue but I can’t see what I’m doing wrong.

EDITED TO SHOW SQL SCHEMA:

Sure, Hopefully the following helps.

Table: Courses
id (PK)| results | Success | Failure | Counter | Grades | Classes |
1        Posted      1         0         2        B+         2
2        Pending     0         0         1        NA         1
3        Posted      0         1         3        F          1
4
5
6
7
8
9
10+

Table: Students
Students_Id (PK) | FirstName | LastName |
     1              Chris        Test
     2               Jen         Test   
     3
     4  
     5
     6
     7
     8
     9
     10+

To keep things easy to read, I removed the information in the other 10+ rows, but there is data populating them.

Also, I noticed in the OP, I’m selecting “Special_Id and SpecialConditions”. That’s actually wrong. I’m not selecting those fields anymore.

When joining tables, does every column have to have data in-order to successfully INNER JOIN or can there be empty rows as well?

  • 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-28T03:21:44+00:00Added an answer on May 28, 2026 at 3:21 am

    Your query shows that you are joining where the id from the Courses table matches the Students_Id from Students. However, the schema makes it look as though id is not actually a student identifier but rather just a record index in that table. It seems to me that you need to have an additional column in Courses for the key to the Students table.

    I tested the JOIN SQL syntax in phpMyAdmin and while it returns as a positive task, I notice that it only shows the original table and not the joined table after being joined.

    Note that you only told the query to select columns that were included in the Courses table. You probably also wanted to select Students.FirstName and Students.LastName (or something similar).

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

Sidebar

Related Questions

I have written the following code to perform some simultaneous HTTP posting and file
In my jquery i have the following code, which for some reason is not
I have following code to perform some regular expression on the string public class
I have following code written to run NSTimer . But the NSTimer selector is
I'm using Remoting to perform some IPC communication, and have the following question: When
I have the following code to perform validation of SubmitForm shown below on click
I have the following code. I would like to perform a if then check
I have the following code which creates a dynamic object that is assigned to
I have the following code: public boolean perform(CronJob job) final Date lastQueryDateTime = new
I have the following code, which should perform the first part of creating a

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.