View previous topic :: View next topic |
Author |
Message |
ludvig87
Joined: 08 Aug 2003 Posts: 54 Location: Denmark
|
Posted: Sun Aug 31, 2003 6:21 pm Post subject: |
|
|
I get this error
Quote: | Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /web/www/frac/users/sunshine/b2archivestest.php on line 104
|
How do I fix that?? and what is it that should be fixed?
I would like the b2archivestest.php file replace the b2archives.php file - can I just rename the test file, to the original file, or is there something that will go wrong if I do so? |
|
Back to top |
|
 |
ludvig87
Joined: 08 Aug 2003 Posts: 54 Location: Denmark
|
Posted: Sun Aug 31, 2003 6:50 pm Post subject: |
|
|
This is my entire b2archivestest.php file:
Code: | <?php include ('header.php'); ?>
<?php
// What's the default list order?
$defaultorderby = "ID";
// Default to ascending to descending?
$defaultorder = "DESC";
// What's your blog file name?
$blogfilename = "index.php";
// What's your site url? (no trailing slash)
$siteurl = "http://www.sunshine.frac.dk";
// What's the name of the table for your posts?
$tablename = "";
// What's the first year you started your b2?
$first_year = "2003";
$this_year = date("Y");
$pagenow = explode("/", $PHP_SELF);
$pagenow = trim($pagenow[(sizeof($pagenow)-1)]);
if ($pagenow == "b2archivestest.php")
include ("blog.header.php");
if(!$way)
$way = "ID";
if(!$order)
$order = "DESC";
if(!$year)
$year = $this_year;
$archive_mode = "postbypost";
$request = " SELECT * FROM $tablename WHERE post_date LIKE '$year%' ORDER BY $way $order";
$result = mysql_query($request);
echo "Archives:";
######################################################
# Feel free to modify the following
######################################################
?>
<form action="<?=$PHP_SELF?>" method="post">
Order by
<select class="form" name="way">
<?
if($way == "ID")
echo '<option value="ID" selected>ID</option>';
else
echo '<option value="ID">ID</option>';
if($way == "post_date")
echo '<option value="post_date" selected>date</option>';
else
echo '<option value="post_date">date</option>';
if($way == "post_title")
echo '<option value="post_title" selected>title</option>';
else
echo '<option value="post_title">title</option>';
?>
</select>
<select class="form" name="order">
<?
if($order == "ASC")
echo '<option value="ASC" selected>Ascending</option>';
else
echo '<option value="ASC">Ascending</option>';
if($order == "DESC")
echo '<option value="DESC" selected>Descending</option>';
else
echo '<option value="DESC">Descending</option>';
?>
</select>
<select class="form" name="year">
<? for($i = $first_year; $i <= $this_year; $i++) {
if($year == $i)
echo "<option value=\"$i\" selected>$i</option>";
else
echo "<option value=\"$i\">$i</option>";
}
?>
</select>
<input type="submit" name="submit" value="sort" />
</form>
<?php
if ($archive_mode == "monthly") {
while($row=mysql_fetch_object($result)) {
$postdata = get_postdata2($row->ID);
$thismonth=mysql2date("Y\-m", $postdata["Date"]);
$linkmonth=mysql2date("Ym", $postdata["Date"]);
$i = "/".$thismonth."/";
if ($thismonth != $previousmonth) {
if (preg_match($i,$postdata["Date"])) {
echo "<a href=\"$siteurl/".$blogfilename."?m=$linkmonth\">";
echo $month[substr($thismonth,5,2)];
echo "</a>";
echo "<br>\n";
}
}
$previousmonth = $thismonth;
}
} elseif ($archive_mode == "postbypost") {
while($row=mysql_fetch_object($result)) {
$postdata = get_postdata2($row->ID);
$thismonth=mysql2date("Y\-m", $postdata["Date"]);
$linkmonth=mysql2date("Ym", $postdata["Date"]);
$i = "/".$thismonth."/";
if ($thismonth != $previousmonth) {
if (preg_match($i,$postdata["Date"])) {
echo "<br><a href=\"$siteurl/".$blogfilename."?m=$linkmonth\">";
echo $month[substr($thismonth,5,2)];
echo "</a>";
echo "<br>\n";
}
}
$previousmonth = $thismonth;
$postdata = get_postdata2($row->ID);
echo $postdata["Date"];
echo " - <a href=\"$siteurl/".$blogfilename."?p=".$row->ID."&c=1"."\">";
if ($postdata["Title"]) {
$postdata["Title"] = stripslashes($postdata["Title"]);
echo $postdata["Title"];
} else {
echo $postdata["ID"];
}
echo "</a>";
echo "<br>\n";
}
}
?>
<form name="searchform" action="<?=$blogfilename?>" method="get">
<input type="text" name="s" class="form" />
<input type="submit" name="submit" value="search" class="form" />
</form>
<?
?>
<?php include ('footer.php'); ?> |
Anyone who can fix this bug??
Code: | Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /web/www/frac/users/sunshine/b2archivestest.php on line 103 |
Its one of these lines, there is something wrong with:
Code: | }
}
$previousmonth = $thismonth;
}
} elseif ($archive_mode == "postbypost") {
while($row=mysql_fetch_object($result)) { |
Anyone who can help? |
|
Back to top |
|
 |
Tang-on
Joined: 14 Aug 2003 Posts: 22
|
Posted: Thu Sep 04, 2003 7:14 am Post subject: |
|
|
Thanks a lot Dodo and Daynah! This is a really cool hack!  _________________ -Tang-on  |
|
Back to top |
|
 |
archiguy
Joined: 05 Mar 2003 Posts: 47
|
|
Back to top |
|
 |
mtwib
Joined: 09 Aug 2003 Posts: 7
|
Posted: Fri Oct 17, 2003 1:03 am Post subject: |
|
|
Hi I keep getting this error:
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/randomne/public_html/mtwib/b2/b2archives.php on line 101
@ http://www.randomness.nu/mtwib/b2/b2archives.php
I followed everything said on this board including the updates that people added, can anyone please help? much appriciated.  |
|
Back to top |
|
 |
gigantus
Joined: 30 Aug 2003 Posts: 12
|
Posted: Tue Oct 21, 2003 2:49 am Post subject: |
|
|
lookie at http://gig.viper007bond.com/archiv.php
i'm getting this error
Quote: |
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/viperaa/public_html/gig/archiv.php on line 185 |
any reason why? _________________ //myBLOG||myART\\
 |
|
Back to top |
|
 |
epolady
Joined: 30 Jul 2002 Posts: 800 Location: Texas
|
|
Back to top |
|
 |
Br3nd4
Joined: 23 Aug 2003 Posts: 4
|
Posted: Wed Oct 22, 2003 7:01 am Post subject: |
|
|
Hmm... the archives hack works fine for me, but when I scan my archives link under W3 HTML Validator, I get 110 HTML errors because of the entity "&c=1" in the weblog entries links. Is there any way to call an archived invidual weblog entrie WITH the comments below it without using that entity?
Otherwise, is there any way to get around this problem? _________________ Everyone is a little-wonder...
[little-wonder.net] |
|
Back to top |
|
 |
Mellissa
Joined: 17 Nov 2002 Posts: 28 Location: Malaysia
|
Posted: Tue Nov 04, 2003 11:46 am Post subject: |
|
|
Awesome, thank you  |
|
Back to top |
|
 |
Vyerse.Vzz.Net
Joined: 07 Jan 2004 Posts: 4
|
Posted: Wed Jan 07, 2004 2:47 pm Post subject: |
|
|
It helps! I am not using it annymore, but thanks! When I did, it helps! _________________
I will help with B2! (I have installed it alot!)
Messeage Me!
|
|
Back to top |
|
 |
mandeieio
Joined: 11 Nov 2003 Posts: 6
|
Posted: Sun Mar 07, 2004 6:55 am Post subject: background not showing up? |
|
|
i have the archives set up and it works great, but when you click on an entry, it takes you to my page layout but there is no background & my html used isn't showing up- my style sheet basic layout is there, just none of the "nice" stuff to make it look good. can someone tell me why?
http://mandeieio.buildtolearn.com/b2/archives.php |
|
Back to top |
|
 |
|