PEAR DB/MySQL Prepared Statement with LIKE

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jmark@fastermail.com

    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 '%?'

  • petersprc

    #2
    Re: PEAR DB/MySQL Prepared Statement with LIKE

    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('M DB2.php');

    $mdb2 = MDB2::singleton ('mysql://user:password@h ost/db');
    $mdb2->loadModule('Ex tended');

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

    Comment

    • jmark@fastermail.com

      #3
      Re: PEAR DB/MySQL Prepared Statement with LIKE

      On Jun 21, 2:42 pm, petersprc <peters...@gmai l.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('M DB2.php');
      >
      $mdb2 = MDB2::singleton ('mysql://user:password@h ost/db');
      $mdb2->loadModule('Ex tended');
      >
      $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?


      Comment

      • Jerry Stuckle

        #4
        Re: PEAR DB/MySQL Prepared Statement with LIKE

        jmark@fastermai l.com wrote:
        On Jun 21, 2:42 pm, petersprc <peters...@gmai l.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@h ost/db');
        >$mdb2->loadModule('Ex tended');
        >>
        >$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.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • jmark@fastermail.com

          #5
          Re: PEAR DB/MySQL Prepared Statement with LIKE

          On Jun 22, 6:56 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
          j...@fastermail .com wrote:
          On Jun 21, 2:42 pm, petersprc <peters...@gmai l.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('M DB2.php');
          >
          $mdb2 = MDB2::singleton ('mysql://user:password@h ost/db');
          $mdb2->loadModule('Ex tended');
          >
          $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...@attgl obal.net
          =============== ===- Hide quoted text -
          >
          - Show quoted text -
          Thanks to you two, I will migrate to mdb2

          Comment

          • Michael Fesser

            #6
            Re: PEAR DB/MySQL Prepared Statement with LIKE

            ..oO(jmark@fast ermail.com)
            >Thanks to you two, I will migrate to mdb2
            What about PDO?

            Micha

            Comment

            Working...