You are here: Re: Gallery Pagination Result Problem « PHP Programming Language « IT news, forums, messages
Re: Gallery Pagination Result Problem

Posted by Rik on 05/06/06 15:26

ste wrote:
> <?php
> include("databasepasswords");
> if (isset($_GET['pageno'])) {
> $pageno = $_GET['pageno'];

Tssk, if thought I told you to escape GET variables if used in queries :-).
$pageno = mysql_real_escape_string(_GET['pageno'],$connection);

> $query = "SELECT count(*) FROM images ".$where;
> $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR);

As said, $where whould be set BEFORE this query.

> $query = "SELECT * FROM images ORDER BY dateadded,
> datetaken DESC $limit ".$where ;

Echo this query and you'll see what's wrong. It should be

$query = "SELECT * FROM images ORDER BY `dateadded`, `datetaken` DESC $where
$limit";

Wether your code creates proper pages I'm not going to check.

For future reference:
Echoing variables after they are set or print_r() arrays will make a lot
more clear to you in debugging.
In this instance, echoing the query would have told you right away the query
was composed in the wrong order.

Grtz,
--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация