0

Just launching the sites but it gives error to me

 Warning: mysql_fetch_array() expects parameter 1 to be resource, Boolean given in C:\xampp\htdocs\real4u\index.php on line 203

and on many area of website , i got MySQL fetch error , please help

Index Code

<?php   if(!(isset($_GET["ps"])))        {
$setting=mysql_query("select * from setting ");
$setting1=mysql_fetch_array($setting);
?>
Bindiya Patoliya
  • 2,718
  • 1
  • 15
  • 15

3 Answers3

0

I think there is a problem is with the use of the ! operator. Try the following:

<?php   if(!isset($_GET["ps"]))        {
$setting=mysql_query("select * from `setting`");
$setting1=mysql_fetch_array($setting);
?>

To get better results troubleshooting you can add this after creating the $setting object

if (false === $setting) {
    echo mysql_error();
}
Conrad Lotz
  • 7,702
  • 3
  • 22
  • 27
0

Try this you will get the reason

$setting = mysql_query("select * from setting ") or die(mysql_error());
Manoj Yadav
  • 6,420
  • 1
  • 20
  • 21
0

First, try to use mysqli or PDO, since mysql_* functions are deprecated since PHP5. Second, check the error that mysql returns by editing your mysql_query:

mysql_query("select * from setting ") or exit(mysql_error());

I guess you haven't established a MySQL connection or your setting table doesn't exists.

Maxime Lorant
  • 31,821
  • 17
  • 84
  • 96