Jump to content

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given


Go to solution Solved by PravinS,

Recommended Posts

i'm wondering what is this problems. i copy paste it to other page. it works fine. but only this page have the error. :shrug:  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 by Kova_Llano
  • Solution

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());

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.