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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:55:41+00:00 2026-06-03T22:55:41+00:00

I am building a simple website that helps students and instructors in universities. I

  • 0

I am building a simple website that helps students and instructors in universities.

I am facing a problem about the following query:
An instructor retrieves the students’ IDs and names who are enrolled in the course he/she teaches.

I have the following tables, followed by their fields:
Enrollment (CourseCode – StudentID – Grade)
Studnet (ID – Name)

As you can see the only connector between the two tables is the student ID.

The code that I wrote is

<?
session_start();
$COCODE = $_SESSION['GlobalCode'];

$result11 = mysql_query("SELECT * FROM Enrollment WHERE CourseCode = '$COCODE' ") ;

$row11 = mysql_fetch_array($result11);
$StID = $row11['StudentID'];
$result22 = mysql_query("SELECT * FROM Student where StudentID= '$StID' ") ;
echo "<table border cellpadding=3>";

while($row123 = mysql_fetch_array($result22)) 
 { 
 echo "<tr>";
 echo "<td>".$row123['ID']."</td> ";
 echo "<td>".$row123['Name']."</td> ";
 echo "</tr>";
 } 

echo "</table>"; 
?>

What I am trying to do is to retrieve the course code from the Enrollment table and then retrieving the students names through the ID.

The problem is that I got the following message:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

I hope you can help me solving the problem.

Thanks

  • 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-03T22:55:42+00:00Added an answer on June 3, 2026 at 10:55 pm

    Have you tried to narrow down which of the queries is causing the problem? That would be your first step. Some other pointers:

    1. you need to check that each SQL query is successful and returning a valid value before using it in the next query… otherwise that query will cause an error.

    2. Try using: mysql_query ($your_query) or die ('Error: '.mysql_error ()); for each query for a more detailed error message. (for debugging only, not for production)

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

Sidebar

Related Questions

I'm building a simple proof-of-concept for an iPad-specific website that would use video transitions
If you are building a simple website using just simple HTML/CSS/Javascript that has say
I'm building a simple website with django that requires constant monitoring of text-based data
I am building a simple website that needs 3 user levels (member, mod, admin)
I'm building a simple contact form for a website. It does not connect to
I'm building a really simple CMS for a bilingual website. The website would have
I am building a simple website. I am going to put Facebook Like Button
I am building a very simple website with a series of images arranged vertically
I'm building a website that allows users to check the availability of international domain
I building a simple, 7 page, database driven, website, and I would like to

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.