[aur-dev] [PATCH 1/2] Removed unused mysql_num_rows result, changed while-loop check from lazy-one to default one

canyonknight at gmail.com canyonknight at gmail.com
Mon Sep 17 21:15:56 EDT 2012


On Mon, Sep 17, 2012 at 8:06 PM, Lukas Fleischer
<archlinux at cryptocrack.de> wrote:
> On Mon, Sep 17, 2012 at 11:19:33AM -0400, canyonknight at gmail.com wrote:
>> On Mon, Sep 17, 2012 at 8:11 AM,  <mario at xenji.com> wrote:
>> > From: "Mario (xenji) Mueller" <mario at xenji.com>
>> >
>> > Signed-off-by: Mario (xenji) Mueller <mario at xenji.com>
>> > ---
>> >  web/lib/acctfuncs.inc.php | 3 +--
>> >  1 file changed, 1 insertion(+), 2 deletions(-)
>> >
>> > diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
>> > index d58c759..6f7c98a 100644
>> > --- a/web/lib/acctfuncs.inc.php
>> > +++ b/web/lib/acctfuncs.inc.php
>> > @@ -327,9 +327,8 @@ function search_results_page($UTYPE,$O=0,$SB="",$U="",$T="",
>> >         }
>> >
>> >         $result = db_query($q, $dbh);
>> > -       $num_rows = mysql_num_rows($result);
>>
>> Is this really unused? I can't check right now, but I have a feeling
>> this breaks account searching. The account search results page is
>> finicky and needs a lot of work (pagination more like package results
>> page, GET requests rather than POST, etc).
>
> I hope it's unused -- you removed it in the PDO patch (which also
> supersedes this one) :)
>

You are correct I removed it in the PDO patch as there isn't a
one-to-one equivalent for mysql_num_rows(). The difference is I also
made a change at the same time to the $num_row reference in
account_search_results.php. So my removal *should* work.

>>
>> >
>> > -       while ($row = mysql_fetch_assoc($result)) {
>> > +       while (($row = mysql_fetch_assoc($result)) != false) {
>>
>> I don't know Lukas' preference here. A style for this should probably
>> be established and used.
>
> The original version is obviously easier to read... I agree that we need
> to improve our coding style guidelines and add some more
> principles/examples.
>

Sounds good.

>>
>> >                 $userinfo[] = $row;
>> >         }
>> >
>> > --
>> > 1.7.12
>> >


More information about the aur-dev mailing list