Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

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

Alejandro_J_
Beginner
21,222 Views

I'm making a private messaging system.
But I got the error message just like this again an again.

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\post\includes\pm_send.php on line 12

pm_send.php code is here

<?php

session_start();
require_once "connect.php";

$sql = "SELECT id, email FROM users WHERE showing='1'";
$result = mysql_query($sql);

$options = "";
$email = $_SESSION['email'];

while ($row=mysql_fetch_array($result)){
$USERid = $row['id'];
$USERname = $row['email'];
$option.="<OPTION VALUE=\"$USERid\">".$USERname."</OPTION>";
}
?>

How to fix it?

0 Kudos
2 Replies
Shenghong_G_Intel
21,222 Views

This issue is not related to this forum....you may find a proper forum for MySQL or PHP to get the answer...

But the issue looks like to be related to the value of "$result" returned from "mysql_query", this function may return a bool value (FALSE) when the query failed (example: no permission), instead of a query data-set. You may refer to this link to get the answer:

http://stackoverflow.com/questions/2973202/mysql-fetch-array-expects-parameter-1-to-be-resource-or-mysqli-result-boole

Hope it helps.

Thanks,

Shenghong

0 Kudos
saxena__kajal
Beginner
21,222 Views

Hello friend if you want  to solve this problem then visit right now this post

How to fix Warning: mysql_fetch_array() expects parameter 1

i hope your problem is solved.

 

 

0 Kudos
Reply