I'm trying really hard to figure out why information from a database won't show up. I think my query is failing, but I've talked to a few people and they don't know why it's not working.
Here's my code leading up to the query:
$getnum = mysql_query("SELECT * FROM articles ORDER BY artnum DESC LIMIT 1");
while($getnumrow = mysql_fetch_array($getnum))
{
$theartnum=$getnumrow['artnum'];
}
$pagenum=intval($_GET['pg']);
if($pagenum==0 || !isset($pagenum))
{
$pagenum=1;
}
$offsetnum = $theartnum-($pagenum*15)+15;
echo("SELECT * FROM articles ORDER BY artnum DESC LIMIT 15 OFFSET $offsetnum");
$result=mysql_query("SELECT * FROM articles ORDER BY artnum DESC LIMIT 15 OFFSET $offsetnum");
I've went over the variables, and all seem to be working. Echoing the query, I get:
SELECT * FROM articles ORDER BY artnum DESC LIMIT 15 OFFSET 85
Which should work, since I've checked and the amount in articles is 85.
Much later in the code, I have:
while($row = mysql_fetch_array($result))
{
$art_title=$row['art_title'];
$art_title_url=$row['art_title_url'];
$art_author=$row['art_author'];
$art_date=$row['art_date'];
$artnumber=$row['artnum'];
$desc=implode(' ', array_slice(explode(' ', $row['article']), 0, 14))."...";
echo "<div class=\"big\"><a href=\"newsn.php?art=".$art_title_url."\">".$art_title."</a></div>
<div class=\"small\">".$art_date." — <a title=\"View more by ".$art_author."\" href=\"author.php?a=".$art_author."\">".$art_author."</a></div>
<span class=\"article\">".$desc."</span><br /><br />";
}
If I put
echo "test";
in there, I don't get that either.
My whole code is here:
(note: It's not complete, I'm still working on the previous/next buttons and I can do that fairly easily)
I'm testing it here until it works.
Thanks!