PDA

View Full Version : What is wrong with this?


Link14716
10-03-2002, 12:37 AM
$prevpagenumber=$pages[pagenumber]-1;
$nextpagenumber=$pages[pagenumber]+1;
$prevquery=$DB_site->query("SELECT pageid FROM highlightpages WHERE pagenumber=$prevpagenumber && highlightid=$pages[highlightid]");
$nextquery=$DB_site->query("SELECT pageid FROM highlightpages WHERE pagenumber=$nextpagenumber && highlightid=$pages[highlightid]");
$prevpageid=$prevquery[pageid];
$nextpageid=$nextquery[pageid];

if ($prevquery!=0) {
$prevpage = "<a href='content.php?s=&action=highlight&do=page&pageid=$prevpageid'>Previous Page</a> | ";
}

if ($nextquery!=0) {
$nextpage = "<a href='content.php?s=&action=highlight&do=page&pageid=$nextpageid'>Next Page</a>";
}It isn't finding anything, even if something exists. Yet, it still shows the links, which are dead links at that. Help?

Xenon
10-03-2002, 03:55 PM
you cant user query here, you have to use query_first:

$prevpagenumber=$pages[pagenumber]-1;
$nextpagenumber=$pages[pagenumber]+1;
$prevquery=$DB_site->query_first("SELECT pageid FROM highlightpages WHERE pagenumber=$prevpagenumber && highlightid=$pages[highlightid]");
$nextquery=$DB_site->query_first("SELECT pageid FROM highlightpages WHERE pagenumber=$nextpagenumber && highlightid=$pages[highlightid]");
$prevpageid=$prevquery[pageid];
$nextpageid=$nextquery[pageid];

if ($prevquery!=0) {
$prevpage = "<a href='content.php?s=&action=highlight&do=page&pageid=$prevpageid'>Previous Page</a> | ";
}

if ($nextquery!=0) {
$nextpage = "<a href='content.php?s=&action=highlight&do=page&pageid=$nextpageid'>Next Page</a>";
}

Link14716
10-03-2002, 09:51 PM
If I knew it'd be a stupid mistake like that, wow.... lol ;)

Thanks :)