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 =
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
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 */
I have an query:
select * from offtime where type='$type'
then I just pass the type variable to the page. Is there a wildcard in
mysql like there is in sqlserver that I can use to grab all the records?
such as select * from offtime where type='%' would grab all.
Thanks,
Eddie
--
PHP
If you want all records, remove the where clause.
select * from mytable
Jim
---Original Message---
From: Edward Peloke
Date: Wednesday, January 08, 2003 02:03:04 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysql wildcard
I have an query:
select * from offtime where
Well, if that is your only condition, why not use:
'select * from offtime' as your query?
I believe the % as a wildcard is standard SQL, so I would *think* it should
work in mysql, have you tried it?
-Brad
Edward Peloke wrote:
I have an query:
select * from offtime where type='$type'
then
You probably want something like:
select * from offtime where type like '{$type}%'
As a side note, are you making sure that $type does not contain any
malicious code?
Cheers,
Marco
--
php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at
In a message dated 1/8/03 2:48:15 PM Pacific Standard
Time, [EMAIL PROTECTED] writes:
I have an query:
select * from offtime where type='$type'
then I just pass the type variable to the page. Is
there a wildcard in mysql like there is in sqlserver
that I can use to grab all the records? such