467,182 Members | 1,024 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,182 developers. It's quick & easy.

PEAR DB/MySQL Prepared Statement with LIKE

I need some assistance on how to create a select statement using PEAR
DB or MySQL with the LIKE function.
That is I am looking of how I can get statement like this work.
SELECT * FROM customer WHERE name LIKE '%?'

Jun 21 '07 #1
  • viewed: 3286
Share:
5 Replies
On Jun 21, 3:00 pm, j...@fastermail.com wrote:
I need some assistance on how to create a select statement using PEAR
DB or MySQL with the LIKE function.
That is I am looking of how I can get statement like this work.
SELECT * FROM customer WHERE name LIKE '%?'
require_once('MDB2.php');

$mdb2 = MDB2::singleton('mysql://user:password@host/db');
$mdb2->loadModule('Extended');

$rows = $mdb2->extended->getAll(
'select * from customer where name like ?',
null, array('%bob%'));

Jun 21 '07 #2
On Jun 21, 2:42 pm, petersprc <peters...@gmail.comwrote:
On Jun 21, 3:00 pm, j...@fastermail.com wrote:
I need some assistance on how to create a select statement using PEAR
DB or MySQL with the LIKE function.
That is I am looking of how I can get statement like this work.
SELECT * FROM customer WHERE name LIKE '%?'

require_once('MDB2.php');

$mdb2 = MDB2::singleton('mysql://user:password@host/db');
$mdb2->loadModule('Extended');

$rows = $mdb2->extended->getAll(
'select * from customer where name like ?',
null, array('%bob%'));
Thanks for the info. But currently I am running on PEAR DB. Is there a
way this can be done in PEAR DB or plain MySQL?
Jun 22 '07 #3
jm***@fastermail.com wrote:
On Jun 21, 2:42 pm, petersprc <peters...@gmail.comwrote:
>On Jun 21, 3:00 pm, j...@fastermail.com wrote:
>>I need some assistance on how to create a select statement using PEAR
DB or MySQL with the LIKE function.
That is I am looking of how I can get statement like this work.
SELECT * FROM customer WHERE name LIKE '%?'
require_once('MDB2.php');

$mdb2 = MDB2::singleton('mysql://user:password@host/db');
$mdb2->loadModule('Extended');

$rows = $mdb2->extended->getAll(
'select * from customer where name like ?',
null, array('%bob%'));

Thanks for the info. But currently I am running on PEAR DB. Is there a
way this can be done in PEAR DB or plain MySQL?

The point being that Pear DB is obsolete. See
<http://pear.php.net/package/DB>.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 22 '07 #4
On Jun 22, 6:56 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
j...@fastermail.com wrote:
On Jun 21, 2:42 pm, petersprc <peters...@gmail.comwrote:
On Jun 21, 3:00 pm, j...@fastermail.com wrote:
>I need some assistance on how to create a select statement using PEAR
DB or MySQL with the LIKE function.
That is I am looking of how I can get statement like this work.
SELECT * FROM customer WHERE name LIKE '%?'
require_once('MDB2.php');
$mdb2 = MDB2::singleton('mysql://user:password@host/db');
$mdb2->loadModule('Extended');
$rows = $mdb2->extended->getAll(
'select * from customer where name like ?',
null, array('%bob%'));
Thanks for the info. But currently I am running on PEAR DB. Is there a
way this can be done in PEAR DB or plain MySQL?

The point being that Pear DB is obsolete. See
<http://pear.php.net/package/DB>.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -

- Show quoted text -
Thanks to you two, I will migrate to mdb2

Jun 22 '07 #5
..oO(jm***@fastermail.com)
>Thanks to you two, I will migrate to mdb2
What about PDO?

Micha
Jun 24 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Joe Randstein | last post: by
3 posts views Thread by Ron King | last post: by
1 post views Thread by webguynow | last post: by
1 post views Thread by webguynow | last post: by
1 post views Thread by James | last post: by
1 post views Thread by paulq182 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.