heshan Posted August 6, 2012 Share Posted August 6, 2012 Hi guys, When evaluating the below SQL query following error appears. Can anyone will give me a solution for this? Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\search student information\veiwSerachResultByAdmission.php on line 131 <?php $class_id='0'; $payment='0'; $query="select * from student_info where admission_no='$admission_no'"; $result=mysql_query($query); while($row = mysql_fetch_array($result)){ $Admission_Number=$row['admission_no']; $Admission_Date=$row['admission_date']; $Student_Full_Name=$row['full_name']; $Student_Name_With_Initials=$row['name_with_initial']; $Date_of_Birt=$row['date_of_birth']; $Religion=$row['religion']; //$Gender=$row['gender']; $Address=$row['address']; $Telephone_Number=$row['telephone_no']; $Grade_on_Admission=$row['grade_on_admission']; $Password=$row['password']; $st_house=$row['st_house']; $Student_description=$row['description_about_st']; } //check class id $query1="select class_id from student_class where admission_no='$admission_no' and year='$year'"; $result1=mysql_query($query1); while($row1=mysql_fetch_array($result1)){ $class_id=$row1['class_id']; } $query="select grade_id,class_name,stream from class where class_id='$class_id'"; $result=mysql_query($query); while($row = mysql_fetch_array($result)){ $Present_Grade=$row['grade_id']; $Present_Class=$row['class_name']; $present_stream=$row['stream']; } $query2="select payment_value from payment_amount inner join payment on payment_amount.amount_id=payment.amount_id where payment.admission_no='$admission_no' and payment_amount.date like '$year-%'"; $result2=mysql_query($query2); while($row2= mysql_fetch_array($result2)){ $payment=$row2['payment_value']; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/266740-sql-problem/ Share on other sites More sharing options...
Pikachu2000 Posted August 6, 2012 Share Posted August 6, 2012 The query failed. Echo mysql_error and your query string and see if you can figure out why. Quote Link to comment https://forums.phpfreaks.com/topic/266740-sql-problem/#findComment-1367200 Share on other sites More sharing options...
heshan Posted August 6, 2012 Author Share Posted August 6, 2012 Thanks a lot..there was a query error in where clause..i fixed it and now it works..:-) Quote Link to comment https://forums.phpfreaks.com/topic/266740-sql-problem/#findComment-1367206 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.