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 defau
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 =
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;
$r
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:
Thanks!
select * from offtime where type='%' didn't work but when I change = to
'like' it works great!
Thanks,
Eddie
-Original Message-
From: Marco Tabini [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 08, 2003 4:57 PM
To: Edward Peloke
Cc: [EMAIL PROTEC
In a message dated 1/8/03 2:48:15 PM Pacific Standard
Time, [EMAIL PROTECTED] writes:
<>
Yes, MySQL has a wild card. It is % for a string of
characters or _ for a single character. You can say
things like where type like 'tp%'. However, if all you
want to do is get all the records from a table, y
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 h
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'
>
>
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
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 Database
10 matches
Mail list logo