Help - Search - Members - Calendar
Full Version: Archive page error
Codegrrl.com Forums > Script Help > Tutorial Help
irulan
I've virtually copied the archive code from the Build a Blog tutorial with only a few modifications. It works fine at www.eidolon-solstice.net/archive.php

I am using the same code again at another site, however I called my "entry" field "issue". But I keep getting the following error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/.../public_html/.../archive.php on line 7

Here's my code:



CODE
<?
include("archive/admin.php");
include("head.inc");

$result = mysql_query("SELECT FROM_UNIXTIME( timestamp, '%Y' ) AS get_year, COUNT(*) AS issues FROM $table GROUP BY get_year");

while ($row = mysql_fetch_array($result)) {
$get_year = $row["get_year"];
$issues = $row["issues"];

echo "<h1>issues from $get_year ($issues)</h1>\n";

$result2 = mysql_query("SELECT timestamp, issueID, title FROM $table WHERE FROM_UNIXTIME( timestamp, '%Y' ) = $get_year ORDER BY timestamp DESC");
?>

<table cellspacing="5" cellpadding="0">

<?
while ($row2 = mysql_fetch_array($result2)) {
$date = date("M y",$row2["timestamp"]);
$issueID = $row2["issueID"];
$title = $row2["title"];

echo "<tr><td>$date</td><td><a href=\"issue.php?id=$issueID\">$title</a></td></tr>";

}
echo "</table>";

}

include("foot.inc");
?>


I found this previous entry and tried to replace COUNT(*) with both COUNT(title) and COUNT(issue) but I continue to get the same error message.

For some reason it's just not getting anything in the $result query on live 5 and I don't know why.

help?

irulan
Nevermind! Apparently my web host is just having backend issues that are messing up some of my scripts.

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.