boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

b2archives hack V1.02
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
ludvig87



Joined: 08 Aug 2003
Posts: 54
Location: Denmark

PostPosted: Sun Aug 31, 2003 6:21 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
ludvig87



Joined: 08 Aug 2003
Posts: 54
Location: Denmark

PostPosted: Sun Aug 31, 2003 6:50 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Tang-on



Joined: 14 Aug 2003
Posts: 22

PostPosted: Thu Sep 04, 2003 7:14 am    Post subject: Reply with quote

Thanks a lot Dodo and Daynah! This is a really cool hack! Very Happy
_________________
-Tang-on Smile
Back to top
View user's profile Send private message Visit poster's website
archiguy



Joined: 05 Mar 2003
Posts: 47

PostPosted: Fri Sep 05, 2003 1:22 pm    Post subject: Reply with quote

just to say thanks to Dodo for this very nice script
i've made a few change : http://www.archiguy.com/blog/b2stats.php
_________________
Archiguy
http://www.archiguy.com
Mais qu'est ce qu'il m'arrive?
Back to top
View user's profile Send private message Visit poster's website
mtwib



Joined: 09 Aug 2003
Posts: 7

PostPosted: Fri Oct 17, 2003 1:03 am    Post subject: Reply with quote

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. Smile
Back to top
View user's profile Send private message Visit poster's website
gigantus



Joined: 30 Aug 2003
Posts: 12

PostPosted: Tue Oct 21, 2003 2:49 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
epolady



Joined: 30 Jul 2002
Posts: 800
Location: Texas

PostPosted: Tue Oct 21, 2003 3:08 am    Post subject: Reply with quote

http://www.tidakada.com/board/viewtopic.php?p=12031#12031 help any? I've never installed this, so I'm just guessing.
_________________
No more support from me. Goodbye!
Go upgrade to WordPress, you'll find better support there.
Back to top
View user's profile Send private message
Br3nd4



Joined: 23 Aug 2003
Posts: 4

PostPosted: Wed Oct 22, 2003 7:01 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Mellissa



Joined: 17 Nov 2002
Posts: 28
Location: Malaysia

PostPosted: Tue Nov 04, 2003 11:46 am    Post subject: Reply with quote

Awesome, thank you Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Vyerse.Vzz.Net



Joined: 07 Jan 2004
Posts: 4

PostPosted: Wed Jan 07, 2004 2:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
mandeieio



Joined: 11 Nov 2003
Posts: 6

PostPosted: Sun Mar 07, 2004 6:55 am    Post subject: background not showing up? Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group