-4

my project partner give me his php project folder to run on my laptop , i am using netbeans and xampp as a cross-platform web server but when i run index.php file ,it will show me this Warning.

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\vekariya\index.php on line 5

so how to solve it .

Kishan Oza
  • 1,665
  • 1
  • 13
  • 38

3 Answers3

0

Write this at the first line of your index.php

<?php
error_reporting(E_ERROR | E_PARSE); 
?>

It is warning not error :)

Kishan Oza
  • 1,665
  • 1
  • 13
  • 38
0

I think there is a problem with your SQL statement, because when there is an error there the statement variable will return a false.

Do you imported the database in phpMyAdmin? Try the SQL statement in the phpMyAdmin SQL console and look, what error you got.

Julian Schmuckli
  • 3,393
  • 11
  • 33
  • 59
-1

Try adding an error catch like

$db->query(".......") or die("Query Error : ".$db->error); 

or

mysql_query("....") or die("Query Error : ".mysql_error()); // Since you are using mysql_query)

This will tell you why your mysql_fetch_array() (Actually you should be using Mysqli / PDO) is not working

user3526204
  • 497
  • 4
  • 21