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 

one more about archives

 
Post new topic   Reply to topic    boardom Forum Index -> How to ?
View previous topic :: View next topic  
Author Message
ax



Joined: 02 Jan 2004
Posts: 4

PostPosted: Fri Jan 02, 2004 3:20 pm    Post subject: one more about archives Reply with quote

i was trying to change the template of the archive's page, when i move something and this happens:

Quote:
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/tazerkc/public_html/cds/b2archives.php on line 76


and the line 76 says:
Quote:

<?php while($row = mysql_fetch_object($result)) { start_b2(); ?>


i don't understand so much about php, and i hope someone can help me.
Back to top
View user's profile Send private message
ax



Joined: 02 Jan 2004
Posts: 4

PostPosted: Fri Jan 02, 2004 11:11 pm    Post subject: Reply with quote

never mind, i already fix-it ^_^
Back to top
View user's profile Send private message
ax



Joined: 02 Jan 2004
Posts: 4

PostPosted: Fri Jan 02, 2004 11:18 pm    Post subject: Reply with quote

the problem was this:

Code:

<?php /* Don't remove this line, it calls the b2 function files ! */ $blog=1; include ("blog.header.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">


<head>

<title><?php bloginfo('name') ?><?php single_post_title(' :: ') ?><?php single_cat_title(' :: ') ?><?php single_month_title(' :: ') ?></title>


<link href="layout.css" rel="stylesheet" type="text/css" />

<link rel="SHORTCUT ICON" href="cds.ico" />


<script language="javascript" type="text/javascript">
<!--
if (window != window.top)
 {top.location.href = location.href;}
// -->
</script>


</head>


<body>
   <div id="container">
      <div id="banner"><img src="evast1.ico"></div>

      <div id="sidebar-a">

<span class="comentario">info:</span> <br />
en proceso<br />
<br />

<span class="comentario">autores:</span> <br />
en proceso<br />
<br />

<span class="comentario">categorías:</span> <br />
<?php list_cats(0, 'All', 'name'); ?> <br />
<br />
<a href="b2archives.php">archivos</a><br />

<br />

<span class="comentario">buscador:</span> <br />
<form name="searchform" method="get" action="<?php echo $PHP_SELF; /*$siteurl."/".$blogfilename*/ ?>">
<p>
<input type="text" name="s" size="15" /><br />
<input type="submit" name="submit" value="buscar" />
</p>
</form>

<span class="comentario">opciones:</span> <br />
<a href="b2login.php">entrar</a><br />
<a href="b2register.php">registrarse</a><br />

      </div>

<div id="content">

<?php while($row = mysql_fetch_object($result)) { start_b2(); ?>

<?php

// *** b2 Archive file

require_once('./b2config.php');
require_once($b2inc.'/b2functions.php');

dbconnect();

// this is what will separate your archive links
$archive_line_separator = '<br />';
// this is what will separate dates on weekly archive links
$archive_week_separator = ' - ';


// archive link url
$archive_link_m = $siteurl.'/'.$blogfilename.$querystring_start.'m'.$querystring_equal;   # monthly archive
$archive_link_w = $siteurl.'/'.$blogfilename.$querystring_start.'w'.$querystring_equal;   # weekly archive
$archive_link_p = $siteurl.'/'.$blogfilename.$querystring_start.'p'.$querystring_equal;   # post-by-post archive


// over-ride general date format ? 0 = no: use the date format set in Options, 1 = yes: over-ride
$archive_date_format_over_ride = 0;


// options for daily archive (only if you over-ride the general date format)
$archive_day_date_format = 'Y/m/d';

// options for weekly archive (only if you over-ride the general date format)
$archive_week_start_date_format = 'Y/m/d';
$archive_week_end_date_format   = 'Y/m/d';


// --- //


$dateformat=get_settings('date_format');
$time_difference=get_settings('time_difference');

if (!$archive_date_format_over_ride) {
   $archive_day_date_format = $dateformat;
   $archive_week_start_date_format = $dateformat;
   $archive_week_end_date_format   = $dateformat;
}

if (basename($HTTP_SERVER_VARS['SCRIPT_FILENAME']) == 'b2archives.php')
   include ('blog.header.php');

if (!isset($querycount)) {
   $querycount = 0;
}

$now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600)));

if ($archive_mode == 'monthly') {
   $arc_sql="SELECT DISTINCT YEAR(post_date), MONTH(post_date) FROM $tableposts WHERE post_date < '$now' AND post_category > 0 ORDER BY post_date DESC";
   $querycount++;
   $arc_result=mysql_query($arc_sql) or die($arc_sql.'<br />'.mysql_error());
   while($arc_row = mysql_fetch_array($arc_result)) {
      $arc_year  = $arc_row['YEAR(post_date)'];
      $arc_month = $arc_row['MONTH(post_date)'];
      echo "<a href=\"$archive_link_m$arc_year".zeroise($arc_month,2).'">';
      echo $month[zeroise($arc_month,2)].' '.$arc_year;
      echo '</a>';
      echo $archive_line_separator."\n";
   }
} elseif ($archive_mode == 'daily') {
   $arc_sql="SELECT DISTINCT YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) FROM $tableposts WHERE post_date < '$now' AND post_category > 0 ORDER BY post_date DESC";
   $querycount++;
   $arc_result=mysql_query($arc_sql) or die($arc_sql.'<br />'.mysql_error());
   while($arc_row = mysql_fetch_array($arc_result)) {
      $arc_year  = $arc_row['YEAR(post_date)'];
      $arc_month = $arc_row['MONTH(post_date)'];
      $arc_dayofmonth = $arc_row['DAYOFMONTH(post_date)'];
      echo "<a href=\"$archive_link_m$arc_year".zeroise($arc_month,2).zeroise($arc_dayofmonth,2).'">';
      echo mysql2date($archive_day_date_format, $arc_year.'-'.zeroise($arc_month,2).'-'.zeroise($arc_dayofmonth,2).' 00:00:00');
#      echo $month[zeroise($arc_month,2)]." $arc_year";
      echo '</a>';
      echo $archive_line_separator."\n";
   }
} elseif ($archive_mode == 'weekly') {
   if (!isset($start_of_week)) {
      $start_of_week = 1;
   }
   $arc_sql="SELECT DISTINCT YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date), WEEK(post_date) FROM $tableposts WHERE post_date < '$now' AND post_category > 0 ORDER BY post_date DESC";
   $querycount++;
   $arc_result=mysql_query($arc_sql) or die($arc_sql.'<br />'.mysql_error());
   $arc_w_last = '';
   while($arc_row = mysql_fetch_array($arc_result)) {
      $arc_year = $arc_row['YEAR(post_date)'];
      $arc_w = $arc_row['WEEK(post_date)'];
      if ($arc_w != $arc_w_last) {
         $arc_w_last = $arc_w;
         $arc_ymd = $arc_year.'-'.zeroise($arc_row['MONTH(post_date)'],2).'-' .zeroise($arc_row['DAYOFMONTH(post_date)'],2);
         $arc_week = get_weekstartend($arc_ymd, $start_of_week);
         $arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']);
         $arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']);
         echo "<a href=\"$siteurl/".$blogfilename."?m=$arc_year&w=$arc_w\">";
         echo $arc_week_start.$archive_week_separator.$arc_week_end;
         echo '</a>';
         echo $archive_line_separator."\n";
      }
   }
} elseif ($archive_mode == 'postbypost') {
   $requestarc = " SELECT ID,post_date,post_title FROM $tableposts WHERE post_date < '$now' AND post_category > 0 ORDER BY post_date DESC";
   $querycount++;
   $resultarc = mysql_query($requestarc);
   while($row=mysql_fetch_object($resultarc)) {
      if ($row->post_date != '0000-00-00 00:00:00') {
         echo "<a href=\"$archive_link_p".$row->ID.'">';
         $arc_title = stripslashes($row->post_title);
         if ($arc_title) {
            echo strip_tags($arc_title);
         } else {
            echo $row->ID;
         }
         echo '</a>';
         echo $archive_line_separator."\n";
      }
   }
}

#echo $querycount."<br />\n";
#timer_stop(1,8);
?>

</div>

<!-- // this is just the end of the motor - don't touch that line either :) -->
   <?php } ?>

<br />

      <div id="footer">Ciudad de Sueños is licensed under a <a href="http://creativecommons.org/licenses/by-nc/1.0/">Creative
Commons License</a></div>
   </div>
</body>
</html>




these lines should not be there:
Code:
<?php while($row = mysql_fetch_object($result)) { start_b2(); ?>


Code:

<!-- // this is just the end of the motor - don't touch that line either :) -->
   <?php } ?>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> How to ? All times are GMT + 1 Hour
Page 1 of 1

 
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