List:General Discussion« Previous MessageNext Message »
From:-Patrick Date:April 28 2006 5:18pm
Subject:Matching Different Tables' Columns and Rows
View as plain text  
Basically, I want to match specific rows with ONLY a specific date.

Here's the code:
mysql_select_db($database_connBlog, $connBlog);
$query_FindArticleDates = "SELECT * FROM blg_article_art, blg_topic_top
WHERE blg_article_art.idtop_art = blg_topic_top.id_top";
$findArticleDates = mysql_query($query_FindArticleDates, $connBlog) or
die(mysql_error());
$findRow_ArticleDates = mysql_fetch_assoc($findArticleDates);
$field_ArticleDates = mysql_fetch_array($findArticleDates);
$totalRows_FindArticleDates = mysql_num_rows($findArticleDates);

<?php for ( $k = $totalRows_FindArticleDates; $k > 0; $k-- ) {
          if (mysql_num_rows($findArticleDates) > 0){
              mysql_data_seek($findArticleDates,0);
              while($findRow_ArticleDates =
mysql_fetch_assoc($findArticleDates)){
                    $dates[] = $findRow_ArticleDates['FindArticleDate'];
              }
          } ?>
       <a href = "weblog/month.php?<?php echo "m=$j&#38;y=$year"?>">
            <? echo $getMonth[$i++]." ".$year; $j++; }?></a>

It is supposed to print the month only IF it there is entries matching
the date. So if there were 3 entries made for one month, then all
entries for that month should be printed. Right now, this prints every
row in existence.

-Patrick

Thread
Matching Different Tables' Columns and Rows-Patrick28 Apr