Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6710637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:02:43+00:00 2026-05-26T08:02:43+00:00

Possible Duplicate: mysql_fetch_array() expects parameter 1 to be resource, boolean given in select This

  • 0

Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select

This is the error I get:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in…..

I tried to find out the error , but I can’t make it…can someone please help me take a look?

<?php

 session_start();


$objConnect = mysql_connect("localhost","root","") or die(mysql_error());
$objDB = mysql_select_db("EMC");


    $haha = $fgmembersite->UserEmail();
    $_SESSION['storedemail']= $haha;



    $query = mysql_query("SELECT * FROM Register WHERE Email= '$haha'");

    while ($row = mysql_fetch_array($query)){

    $id = $row['ID'];

    }
    mysql_free_result($query);



    $txtFirstName = isset($_GET['txtFirstName']) ? $_GET['txtFirstName'] : ""; 
    $txtLastName = isset($_GET['txtLastName']) ? $_GET['txtLastName'] : "";
    $txtCell = isset($_GET['txtCell']) ? $_GET['txtCell'] : "";

    ?>

    <html>


    <body>

    <form name="frmSearch" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
    <table width="599" border="1">
    <tr>
    <th>Keyword</th>

  <input name="txtFirstName" type="text" id="txtFirstName" value='<?php echo htmlentities($txtFirstName) ?>'>

  <input name="txtLastName" type="text" id="txtLastName" value='<?php echo htmlentities($txtLastName) ?>'>

  <input name="txtCell" type="text" id="txtCell" value='<?php echo htmlentities($txtCell) ?>'>



  <?

 $opselect="SELECT DISTINCT Custgroup FROM UserAddedRecord";

 $result = mysql_query ($opselect);

 while($nt=mysql_fetch_array($result))
 {
 ?>
 <option><?= $nt[Custgroup]?></option>";

 <?
 }
 ?>

 </select>
 <input type="submit" value="Search">
 </tr>
 </table>
</form>
<?
if (isset($_GET["txtFirstName"]) != "" || isset($_GET["txtLastName"]) != "" || isset($_GET["txtCell"]) != "" || isset($_GET["txtGroup"]) != "")
{
$objConnect = mysql_connect("localhost","root","") or die(mysql_error());
$objDB = mysql_select_db("EMC");
// Search By Name or Email
$strSQL = "SELECT * FROM UserAddedRecord WHERE (FirstName LIKE '%".$_GET["txtFirstName"]."%' and LastName LIKE '%".$_GET["txtLastName"]."%' and Cell LIKE '%".$_GET["txtCell"]."%' and Custgroup LIKE '%".$_GET["txtGroup"]."%')";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);


$Per_Page = 2;   // Per Page

    if(!isset($_GET['Page'])) 
        {
            $Page = 1;
        }
     else 
        {
            $Page = $_GET['Page'];
        }

$Prev_Page = $Page-1;
$Next_Page = $Page+1;

$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
    $Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
    $Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
    $Num_Pages =($Num_Rows/$Per_Page)+1;
    $Num_Pages = (int)$Num_Pages;
}


$strSQL .=" order  by addedrec_ID DESC LIMIT $Page_Start , $Per_Page";
$objQuery  = mysql_query($strSQL);

?>
<table width="600" border="1">
  <tr>
    <th width="50"> <div align="center">#</div></th>
    <th width="91"> <div align="center">CustomerID </div></th>
    <th width="98"> <div align="center">Name </div></th>
    <th width="198"> <div align="center">Email </div></th>
    <th width="97"> <div align="center">MobileCompany </div></th>
    <th width="59"> <div align="center">Cell </div></th>
    <th width="71"> <div align="center">WorkPhone </div></th>
  </tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
  <tr>
    <td><div align="center"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<?=$objResult["addedrec_ID"];?>"></div></td>
    <td><div align="center"><?=$objResult["addedrec_ID"];?></div></td>
    <td><?=$objResult["FirstName"];?></td>
    <td><?=$objResult["LastName"];?></td>
    <td><div align="center"><?=$objResult["MobileCompany"];?></div></td>
    <td align="right"><?=$objResult["Cell"];?></td>
    <td align="right"><?=$objResult["Workphone"];?></td>
  </tr>
<?
}
?>
</table>
<br>
Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page :
<?
if($Prev_Page)
{
       if($_GET["txtFirstName"] == "")
                  {
    echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtLastName=$_GET[txtLastName]'><< Back</a> ";    
                  }

        else
                  {
    echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtFirstName=$_GET[txtFirstName]'><< Back</a> ";
                  }

}

for($i=1; $i<=$Num_Pages; $i++){
    if($i != $Page)
    {

        echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtFirstName=$_GET[txtFirstName]'>$i</a> ]"; 

    }
    else
    {
        echo "<b> $i </b>";
    }
}
if($Page!=$Num_Pages)
{
          if($_GET["txtFirstName"] == "" && $_GET["txtLastName"] == "" && $_GET["txtCell"] == "")
                       {
            echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtGroup=$_GET[txtGroup]'>Next>></a> ";
                       }
          else if($_GET["txtFirstName"] == "" && $_GET["txtLastName"] == "")
                       {
            echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtCell=$_GET[txtCell]'>Next>></a> ";    
                       }
          else if($_GET["txtFirstName"] == "" )
                       {
        echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtLastName=$_GET[txtLastName]'>Next>></a> ";    
                       }
          else
                       {
            echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtFirstName=$_GET[txtFirstName]'>Next>></a> ";  }
                   }

mysql_close($objConnect);


}   

   else 
   {

$strSQL = "SELECT * FROM UserAddedRecord WHERE user_id='$id'";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);

$Per_Page = 2;   // Per Page

    if(!isset($_GET['Page'])) 
        {
            $Page = 1;
        }
    else 
        {
            $Page = $_GET['Page'];
        }

$Prev_Page = $Page-1;
$Next_Page = $Page+1;

$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
    $Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
    $Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
    $Num_Pages =($Num_Rows/$Per_Page)+1;
    $Num_Pages = (int)$Num_Pages;
}


$strSQL .=" order  by id DESC LIMIT $Page_Start , $Per_Page";
$objQuery  = mysql_query($strSQL);





?>
<table width="600" border="1">
  <tr>
    <th width="50"> <div align="center">#</div></th>
    <th width="91"> <div align="center">ID </div></th>
    <th width="198"> <div align="center">First Name </div></th>
    <th width="198"> <div align="center">Last Name </div></th>
    <th width="250"> <div align="center">Mobile Company </div></th>
    <th width="100"> <div align="center">Cell </div></th>
    <th width="100"> <div align="center">Workphone </div></th>
    <th width="100"> <div align="center">Group </div></th>
  </tr>
<?

    echo "<form name='form1' method='post' action=''>";

while($objResult = mysql_fetch_array($objQuery))
{


    echo "<tr>";
    echo "<td align='center'><input name=\"checkbox[]\" type=\"checkbox\" id=\"checkbox[]\" value=\"$objResult[addedrec_ID]\"></td>";
    echo "<td>$objResult[addedrec_ID] </td>";
    echo "<td>$objResult[FirstName]</td>";
    echo "<td>$objResult[LastName] </td>";
    echo "<td>$objResult[MobileCompany] </td>";
    echo "<td>$objResult[Cell] </td>";
    echo "<td>$objResult[WorkPhone] </td>";
    echo "<td>$objResult[Custgroup] </td>";

   echo "</tr>";

}


     echo "<td colspan='7' align='center'><input name=\"delete\" type=\"submit\" id=\"delete\" value=\"Delete\">";

   if(isset($_POST['delete'])) // from button name="delete"
 {
   $checkbox = $_POST['checkbox']; //from name="checkbox[]"
     $countCheck = count($_POST['checkbox']);

    for($d=0;$d<$countCheck;$d++)
     {
         $del_id  = $checkbox[$d];

    $sql = "DELETE from UserAddedRecord where addedrec_ID = $del_id";

    $result2=mysql_query($sql);

     }
         if($result2)
     {  
             header('Location: customer-adddata.php');
         }
         else
         {
    echo "Error: ".mysql_error();
         }
 }

    echo "</form>";

?>
</table>
<br>
Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page :
<?
if($Prev_Page)
{
       if($_GET["txtFirstName"] == "")
                  {
    echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtLastName=$_GET[txtLastName]'><< Back</a> ";    
                  }

        else
                  {
    echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtFirstName=$_GET[txtFirstName]'><< Back</a> ";
                  }

}

for($i=1; $i<=$Num_Pages; $i++){
    if($i != $Page)
    {

        echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtFirstName=$_GET[txtFirstName]'>$i</a> ]"; 

    }
    else
    {
        echo "<b> $i </b>";
    }
}
if($Page!=$Num_Pages)
{
          if($_GET["txtFirstName"] == "" && $_GET["txtLastName"] == "")
                       {
            echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtCell=$_GET[txtCell]'>Next>></a> ";    
                       }
          else if($_GET["txtFirstName"] == "" )
                       {
        echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtLastName=$_GET[txtLastName]'>Next>></a> ";    
                       }
          else
                       {
            echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtFirstName=$_GET[txtFirstName]'>Next>></a> ";  }
                   }

mysql_close($objConnect);



   }






   ?>
  </body>
  </html>

Thanks in advance.

Problem solved.

Thanks for everyone replied my question , here is my error:

Notice: Unknown column ‘id’ in ‘order clause’ in …..

I forgot to change my id here:

    $strSQL .=" order  by id DESC LIMIT $Page_Start , $Per_Page";
$objQuery  = mysql_query($strSQL) or trigger_error(mysql_error());;

It should be:

    $strSQL .=" order  by addedrec_ID DESC LIMIT $Page_Start , $Per_Page";

Allow me to say thanks again and wish everyone a very good day .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:02:44+00:00Added an answer on May 26, 2026 at 8:02 am

    Your query has failed somehow, and returned a boolean FALSE instead of a statement handle. Add this to find out why:

    $query = mysql_query(...);
    if ($query === FALSE) {
       die(mysql_error());
    }
    

    Never assume a database operation was successful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: “Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given” error while
Possible Duplicate: “Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given” error while
Possible Duplicate: mysql_fetch_array() expects parameter 1 to be resource, boolean given in select When
Possible Duplicate: mysql_fetch_array() expects parameter 1 to be resource, boolean given in select Here's
Possible Duplicate: mysql_fetch_array() expects parameter 1 to be resource, boolean given in select i
Possible Duplicate: PHP Error: mysql_fetch_array() expects parameter 1 to be resource, boolean given Hello
Possible Duplicate: mysql_fetch_array() expects parameter 1 to be resource, boolean given in select I
Possible Duplicate: mysql_fetch_array() expects parameter 1 to be resource, boolean given in select I
Possible Duplicate: mysql_fetch_array() expects parameter 1 to be resource, boolean given in select when
Possible Duplicate: mysql_fetch_array() expects parameter 1 to be resource, boolean given in select I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.