Re: Problem after moving servers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You don't need to print the query anymore - I already did that. You
need to change your code because right now it is open for SQL
injection attacks: I added some SQL to the url and generated an SQL
error (http://www.iwdp.co.uk/list.php?region=1&start=30,2). When you
retrieve start, e.g. $_GET['start'], do a check to make sure the value
is an integer.

The good news is that the query looks fine:
SELECT d.id AS id FROM designers d, designer_regions dr WHERE
dr.region_id=1 AND dr.designer_id=d.id AND d.view=1 ORDER BY d.id ASC
LIMIT 0, 30;

Can you run this query directly on the database and see what the result is?

Also check if you get an error after setting error_reporting to E_ALL.

On Sun, Aug 31, 2008 at 1:16 PM, Evert Lammerts
<evert.lammerts@xxxxxxxxx> wrote:
> The code you've sent seems to be fine, and if I check your website it
> does everything it should do in terms of filtering - if I select
> Tayside as a region I get a development company with the region set to
> Tayside. It seems to me that this means the problem is not in one of
> the subclasses of ProfileList, so not a compatibility issue on that
> level ($this->query works fine).
>
>> while( $row = $db->getrow() )
> seems to stop after one loop. This is either because there are no more
> results - the query is limited to 1, so $count=1 - or because
> $db->getRow generates an error.
>
>> COUNT and $count look like they have different roles to me, COUNT is the amount of
>> designers to be listed per page, $count is the number of designers to be listed altogether,
>> so 150 designers would give me 5 pages of 30 designers.
>
> In ProfileList::render the query is appended with "LIMIT $start,
> $count", and the results of the query all seem to be rendered. This
> probably means that $count and COUNT should have the same value - 30 -
> and that the render function is initially called with the global
> variable COUNT as parameter.
>
> To check what goes wrong you first need to set error_reporting to
> E_ALL in php.ini and restart your webserver, or add the line
> error_reporting(E_ALL); at the beginning of you code. After that you
> need to print the query from ProfileList::render. Can you adjust the
> function and add var_dump($q); after the line $q = $q." LIMIT $start,
> $count ";?
>
> Evert
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux