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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:30:23+00:00 2026-06-01T23:30:23+00:00

Please i need your help with my script. Whenever i include AND maintable.semester_name =

  • 0

Please i need your help with my script. Whenever i include

AND maintable.semester_name = '$semester_name'

in the MySQL Query, it returns 0 for both values of semester_name, when actually
only one is supposed to have a value of 0 when echo $nums is processed. When i
remove

AND maintable.semester_name = '$semester_name'

the query gives normal results as i expect.

Thanks.

$query = "SELECT *             
   FROM maintable 
   WHERE maintable.matric_no = '$matric_no'
   AND   maintable.session = '$session'
   AND   maintable.semester_name = '$semester_name'
   AND   maintable.level = '$level'";
$result = mysql_query($query);
$nums = mysql_numrows($result);
echo $nums ;                  

TABLE STRUCTURE

COURSES
  course_id int(100) 
  course_code varchar(100) 
  course_title varchar(100) 
  course_unit int(10) 

MAINTABLE
  maintable_id int(255) 
  matric_no int(10) 
  session varchar(10) 
  semester_name varchar(10) 
  course_code varchar(10) 
  level int(10) 
  score int(10) 
  grade varchar(4) 

RESULT_UPLOAD
  upload_id int(10) 
  session varchar(10) 
  semester_name  varchar(10) 
  course_code varchar(10) 
  level varchar(10) 

SEMESTER
  semester_id int(10) 
  semester_name varchar(10) 

STUDENT
  matric_no int(10) 
  first_name varchar(100) 
  last_name varchar(100) 
  other_name varchar(100) 
  level int(10) 

USERS
  users_id int(10) 
  title varchar(20) 
  first_name varchar(20) 
  last_name varchar(20) 
  username varchar(20) 
  password varchar(100) 
  register_date datetime 
  tmp_name varchar(100) 
  type varchar(20) 
  name varchar(20) 
  size int(10) 

YEAR
  level_id int(10) 
  level int(10) 
  • 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-01T23:30:25+00:00Added an answer on June 1, 2026 at 11:30 pm

    The query is correct. I guess your conditions really don’t match any rows in the table. Just check what values you have in the database and what your are passing into the conditions.

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

Sidebar

Related Questions

Please I need your help with my script. I'm trying to insert values into
Please i need your help with how to include INDEXES in my tables, i've
please i need you help with my script.. I'm trying to echo some content
please I need your help with a Linq expression: I have nested objects with
I'm new to this ExpandableListView and I desperately need your help please. I'm using
Please your opinion on the following code. I need to calculate the diff in
Please help! I need to produce a Crystal Report with multiple data columns, but
I need some help! Please. I am trying to develop a very very simple
Please help to the newbie in WPF! I need to build a TreeView with
Need some help, please. I have a line of horizontal thumbnails loaded as ONE

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.