Re: [PHP-DB] MySQL Wildcard

[email protected] (Onur Yerlikaya)
Newsgroups php.db
Message-ID <[email protected]>
so sorry

function getOptGrps($ID=null){
    $extraClause = "";
    if($ID != "All")
    {
		$extraClause = " WHERE OptGrpID LIKE '$ID' ";
	}
    $q = "SELECT * FROM ".OPT_GRPS_TABLE.$extraClause;
    $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;
 }


On May 7, 2010, at 12:36 PM, Karl DeSaulniers wrote:

> 
> On May 7, 2010, at 4:16 AM, Onur Yerlikaya wrote:
> 
>> function getOptGrps($ID=null){
>>     if ($ID == "All") {
>>        $ID = "%"; // % = MySQL multi character wildcard
>>     }
>>     $extraClause = "";
>>     if(!is_null($ID))
>>     {
>>         $extraClause = " WHERE OptGrpID LIKE '$ID' ";
>>     }
>>     $q = "SELECT * FROM ".OPT_GRPS_TABLE.$extraClause;
>>     $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;
>>  }
>> 
>> 
>> 
>> On May 7, 2010, at 11:46 AM, Karl DeSaulniers wrote:
>> 
>>> ...
>> 
>> --
>> Onur Yerlikaya
> 
> Thanks Onur, but same error message.
> It is not setting the % as a wild card.
> Not sure the way around this.
> 
> 
> Karl
> 
>> 
>> 
>> 
>> 
>> -- 
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--
Onur Yerlikaya
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.