MySQL Wildcard

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello All,
What I want to do is get all the fields from a table without specifying which ID to grab from. I am trying to implement a wildcard in my query. What am I doing wrong? I keep getting...

"Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource"

CODE:::::

function getOptGrps($ID){
      if ($ID == "All") {
         $ID = "%"; // % = MySQL multi character wildcard
      }
$q = "SELECT * FROM ".OPT_GRPS_TABLE." WHERE OptGrpID LIKE '$ID' ";
      $result = $this->query($q);
      /* Error occurred, return given name by default */
      if(!$result || (mysql_numrows($result) < 1)){
         return NULL;
      }
      /* Return result array */
      $array_results = mysql_fetch_array($result);
      return $array_results;
   }

AND this does not work either

function getOptGrps(){
      $q = "SELECT * FROM ".OPT_GRPS_TABLE;
      $result = $this->query($q);
      /* Error occurred, return given name by default */
      if(!$result || (mysql_numrows($result) < 1)){
         return NULL;
      }
      /* Return result array */
      $array_results = mysql_fetch_array($result);
      return $array_results;
   }

TIA,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux