By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,017 Members | 1,158 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,017 IT Pros & Developers. It's quick & easy.

PEAR DB/MySQL Prepared Statement with LIKE

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
..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.