Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Alejandro_J_
Beginner
5,272 Views

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

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
5,272 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-m...

Hope it helps.

Thanks,

Shenghong

saxena__kajal
Beginner
5,272 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.

 

 

Reply