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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:30:47+00:00 2026-06-18T08:30:47+00:00

im trying to get values from a database but it shows mysql_fetch_array() expects parameter

  • 0

im trying to get values from a database but it shows “mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\kcms\a.php on line 15” error. Can someone help me?

    <?php
    //include 'functions.php';
    $con = mysql_connect("localhost","Akash","kaka123");
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
    $student = false;
    $teacher = false;
    $office = false;
    $username = 56;
    $password = 38;
    $query= "SELECT Register_no , Password FROM student profile WHERE Register_no=$username AND Password=$password" ;
    $result = mysql_query($query, $con);
    $prnt=mysql_fetch_array($result);
    if ($prnt[0]==NULL) 
    {
        $auth=0;
    }
    else
    {
        $auth=1;
        $student= true;
    }
    if ($auth==0) 
    {
        $query= "SELECT Staff_id , Password FROM staff profile WHERE Staff_id=$username AND Password=$password" ;
        $result = mysql_query($query, $con);
        $prnt=mysql_fetch_array($result);
        if ($prnt[0]=NULL) 
        {
            $auth=0;
        }
        else
        {
            $auth=1;
            $teacher = true;
        }
    }    
    if ($auth==0) 
    {
        $query= "SELECT Staff_id , Password FROM office staff WHERE Staff_id=$username AND Password=$password" ;
        $result = mysql_query($query, $con);
        $prnt=mysql_fetch_array($result);
        if ($prnt[0]==NULL) 
        {
            $auth=0;
        }
        else
        {
            $auth=1;
            $office = true;
        }
    }
    echo $username; 
    ?>

can someone please reply soon?

  • 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-18T08:30:49+00:00Added an answer on June 18, 2026 at 8:30 am

    The error message is actually very precise and helpful. mysql_fetch_array() is being called with a boolean value where a resource is expected. If you look at the documentation for mysql_query(), you will see that it returns FALSE on failure, which is a boolean. This value is stored in $result, which is then passed to mysql_fetch_array(). So, an error occurs with your SQL query. You can check the error like this:

    $result = mysql_query("SELECT Register_no , Password FROM student profile WHERE Register_no=$username AND Password=$password") or die(mysql_error());
    

    That being said, you have a space between “student” and “profile” which should not be there. You probably meant to put an underscore there?

    Also, please consider using MySQLi or PDO instead as the mysql_* extension is deprecated. I am merely name dropping here, so please take the time to read about these.

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

Sidebar

Related Questions

I'm trying to get the $url value to display from the MySQL database but
I'm trying to get the values from a pointer to a float array, but
So I'm trying to get the values from a SQLite database into a cursor,
I am trying to get returned values from database from a PHP array to
I'm trying to get values from nsdata class and doesn't work. here is my
I am trying to get values from a data set. My function has to
I am trying to get the values from an HTML table row. When I
I am trying to get double values from file using fscanf function. I am
I am trying to get the privacy values (from privacy table) for photos that
I'm trying to get the pixel rgb values from a 64 x 48 bit

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.