Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #1854

Re: database access

From sheldonlg <sheldonlg@thevillages.net>
Newsgroups comp.lang.php
Subject Re: database access
Date 2011-05-26 10:33 -0400
Organization A noiseless patient Spider
Message-ID <irloar$rma$2@dont-email.me> (permalink)
References <7ded58f7-d089-4a1e-ba94-38183b0ec851@z37g2000vbl.googlegroups.com> <irlj7n$oo5$1@dont-email.me> <9c7045e4-3415-4dfd-a3f7-96ab2de8b623@hd10g2000vbb.googlegroups.com> <irlo6e$rma$1@dont-email.me>

Show all headers | View raw


On 5/26/2011 10:30 AM, sheldonlg wrote:
> On 5/26/2011 9:37 AM, Jivanmukta wrote:
>>> Do you really need to use PDO ?
>>> Whats wrong with the regular PHP mysql_XXXX() functions ?
>>
>> I could not solve some problem with mysqli and this problem did not
>> occur using PDO. Nobody could help me with this problem on newsgroups.
>> If I remember correctly fetching some nonempty query returned false in
>> mysqli, in PDO the same query returned proper set.
>
> If the query is non-empty, you should have no problem in fetching the
> results with the standard mysql functions. Why were you even bothering
> with mysqli? Look for mysql_query, mysql_fetch_assoc, and
> mysql_fetch_array in www.php.net. They are all you need.
>
> What I regularly use most is:
>
> $theArray = array();
> $result = mysql_query("The query text");
> if (FALSE !== $result) {
> while ($row = mysql_fetch_assoc($result) {
> $theArray[] = $row;
> }
> }
>
> if (count($theArray)) {
> .....
> }
>
>
> You could even put the query into your database class as a
> getArray($query) method.
>

Ooops.  Make that
if (count($theArray) > 0) {

-- 
Shelly

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

database access Jivanmukta <jivanmukta@poczta.onet.pl> - 2011-05-25 10:17 -0700
  Re: database access Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-25 17:37 -0400
    Re: database access sheldonlg <sheldonlg@thevillages.net> - 2011-05-26 08:09 -0400
      Re: database access Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-26 09:00 -0400
        Re: database access sheldonlg <sheldonlg@thevillages.net> - 2011-05-26 10:22 -0400
          Re: database access Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-26 11:41 -0400
            Re: database access sheldonlg <sheldonlg@thevillages.net> - 2011-05-26 12:07 -0400
              Re: database access sheldonlg <sheldonlg@thevillages.net> - 2011-05-26 12:14 -0400
    Re: database access sophal chao <w3cyberlearning@gmail.com> - 2011-05-29 13:41 -0700
      Re: database access Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-29 23:12 -0400
  Re: database access JohnT <john@example.com> - 2011-05-26 13:05 +0000
    Re: database access Jivanmukta <jivanmukta@poczta.onet.pl> - 2011-05-26 06:37 -0700
      Re: database access sheldonlg <sheldonlg@thevillages.net> - 2011-05-26 10:30 -0400
        Re: database access sheldonlg <sheldonlg@thevillages.net> - 2011-05-26 10:33 -0400
      Re: database access Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-26 11:43 -0400
    Re: database access Michael Fesser <netizen@gmx.de> - 2011-05-26 19:48 +0200
      Re: database access Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@spamyourself.com> - 2011-05-30 10:56 +0200

csiph-web