0

I want to retrieve records in my database in order to manage details. The below error message displayed when i trying to do that. Can anyone help me out?

( ! ) Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\Student registration\manage student details\manageStudentDetailsForm.php on line 250

<?php

$class_id='0';
$amount_id='0';

$query="SELECT * FROM student_info where student_info.admission_no='$admission_no'";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
$s_id=$row['st_id'];
$first=$row['admission_no'];
$sec=$row['admission_date'];
$third=$row['full_name'];
$forth=$row['name_with_initial'];
$fifth=$row['date_of_birth'];
$sixth=$row['religion'];
//$seven=$row['gender'];
$eight=$row['address'];
$nine=$row['telephone_no'];
$ten=$row['grade_on_admission'];
$leven=$row['password'];
$twoel=$row['st_house'];
$description_about_st=$row['description_about_st'];
}

$query2="SELECT class_id FROM student_class where admission_no='$admission_no'
         AND year='$year'";

$result2=mysql_query($query2);
         while($row2=mysql_fetch_array($result2)){
         $class_id=$row2['class_id'];
}

$query3="SELECT class_name,grade_id,stream FROM class where class_id='$class_id'";
$result3=mysql_query($query3);
         while($row3=mysql_fetch_array($result3)){
         $class_name=$row3['class_name'];
         $grade_id=$row3['grade_id'];
         $stream=$row3['stream'];
}

$query="select amount_id from payment where admission_no='$admission_no'";
$result=mysql_query($query);while($row = mysql_fetch_array($result)){ **            **// line 250
        $amount_id=$row['amount_id'];
}

$query="select payment_value from payment_amount  where amount_id='$amount_id' and date like '$year-%'";
$result=mysql_query($query);
        while($row = mysql_fetch_array($result)){
        $payment_value=$row['payment_value'];
}

?>

Edited by Nick Evan: Fixed formatting

4
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by Venom Rush
0

Hey,

This might be wrong, I haven't ran it.. But, if this is all in the same .php file, then surely you've already defined $result above? So when you do this:

$query="select amount_id from payment where admission_no='$admission_no'";
$result=mysql_query($query);
while($row = mysql_fetch_array($result)){ ** **// line 250
$amount_id=$row['amount_id'];
}

Maybe that is what is triggering it.

0

This is telling you that the variable in your query is empty. Try echoing out the query to make sure it is as expected and then run what is echo'd out directly in phpMyAdmin to see if you get any errors there as well.

$query="select amount_id from payment where admission_no='$admission_no'";
echo $query;
0

I tried echoing and it generates result. The query was not empty. It says,

" select amount_id from payment where admission_no='2012/2' ".

0

And have you run this in phpmyadmin to see what result or error you get directly from the query in the database?

0

I would double check that $admission_no has a value assigned to it. The rest of the query seems to be fine.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.