Re: [PHP-DB] MySQL Wildcard

2010-05-07 Thread Onur Yerlikaya
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

Re: [PHP-DB] MySQL Wildcard

2010-05-07 Thread Karl DeSaulniers
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 =

Re: [PHP-DB] MySQL Wildcard

2010-05-07 Thread Onur Yerlikaya
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

[PHP-DB] MySQL Wildcard

2010-05-07 Thread Karl DeSaulniers
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:

RE: [PHP-DB] mysql wildcard

2003-01-09 Thread Edward Peloke
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

Re: [PHP-DB] mysql wildcard

2003-01-08 Thread janet
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

Re: [PHP-DB] mysql wildcard

2003-01-08 Thread Marco Tabini
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

Re: [PHP-DB] mysql wildcard

2003-01-08 Thread Brad Bonkoski
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' > >

Re: [PHP-DB] mysql wildcard

2003-01-08 Thread Jim Hunter
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

[PHP-DB] mysql wildcard

2003-01-08 Thread Edward Peloke
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