Kova_Llano Posted March 3, 2014 Share Posted March 3, 2014 (edited) i'm wondering what is this problems. i copy paste it to other page. it works fine. but only this page have the error. spend most of time searching solution and i google for other solution still not working. the dreamweaver said there is no syntax error but when running it on localhost. then this appear"Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\fpdf\form3_final_dead.php on line 14" <?php include('database.php'); $data=mysql_query("SELECT OT.nostaf, OT.otl_tkh_m, OT.otl_tkh_y ,OT.otl_jum_jam, OT.otl_jabatan FROM ot_line OT"); while($row = mysql_fetch_array($data)) <<Line 14>> { $bil = $bil +1; ?> 2nd, i'm creating a form..it should be look like this : http://prntscr.com/2xfd0g but when run on localhost, this happen : http://prntscr.com/2xfd48//note that, there is a missing column in the page. the code also contain this <?php include('database.php'); $data=mysql_query("SELECT OT.otl_tkh_d, OT.otl_tkh_m, OT.otl_tkh_y , OT.otl_aktiviti, OT.otl_jabatan FROM ot_line OT"); while($row = mysql_fetch_array($data)) { $bil = $bil +1; ?> Edited March 3, 2014 by Kova_Llano Quote Link to comment https://forums.phpfreaks.com/topic/286669-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given/ Share on other sites More sharing options...
Solution PravinS Posted March 3, 2014 Solution Share Posted March 3, 2014 at this line add mysql_error() like this and check what is the issue $data=mysql_query("SELECT OT.nostaf, OT.otl_tkh_m, OT.otl_tkh_y ,OT.otl_jum_jam, OT.otl_jabatan FROM ot_line OT") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/286669-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given/#findComment-1471304 Share on other sites More sharing options...
Kova_Llano Posted March 3, 2014 Author Share Posted March 3, 2014 thanks mate. its solve. it work perfectly on live server but its appearing "no database found" when running it offline. the database.php also include in the folder. Quote Link to comment https://forums.phpfreaks.com/topic/286669-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given/#findComment-1471305 Share on other sites More sharing options...
PravinS Posted March 3, 2014 Share Posted March 3, 2014 thanks mate. its solve. it work perfectly on live server but its appearing "no database found" when running it offline. the database.php also include in the folder. it means you haven't created database on your local machine or the database connection in database.php is not correct Quote Link to comment https://forums.phpfreaks.com/topic/286669-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given/#findComment-1471306 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.