On 4/25/06, -Patrick <[EMAIL PROTECTED]> wrote:
> Hi Folks,
> Here is the table for the articles:
>
> CREATE TABLE `blg_article_art` (
>   `id_art` int(11) NOT NULL auto_increment,
>   `idtop_art` int(11) NOT NULL default '0',
>   `title_art` varchar(100) NOT NULL default '',
>   `description_art` blob NOT NULL,
>   `text_art` longtext NOT NULL,
>   `date_art` datetime default NULL,
>   PRIMARY KEY  (`id_art`)
> ) TYPE=MyISAM AUTO_INCREMENT=117 ;
>
> Here is the table for the comments:
> CREATE TABLE `blg_comment_com` (
>   `id_com` int(11) NOT NULL auto_increment,
>   `idart_com` int(11) NOT NULL default '0',
>   `text_com` text NOT NULL,
>   `idusr_com` int(11) NOT NULL default '0',
>   `date_com` datetime default NULL,
>   `time_com` time default NULL,
>   `valid_com` tinyint(4) NOT NULL default '0',
>   PRIMARY KEY  (`id_com`),
>   FULLTEXT KEY `text_com` (`text_com`),
>   FULLTEXT KEY `text_com_2` (`text_com`)
> ) TYPE=MyISAM AUTO_INCREMENT=128 ;
>
> And here is two attempts below that Ive tried thus far to the best of my
> ability:
> attept 1:
> mysql_select_db($database_connBlog, $connBlog);
> $query_rsComments = sprintf("SELECT blg_comment_com.idart_com,
> blg_user_usr.username_usr, blg_comment_com.text_com,
> blg_comment_com.date_com, blg_comment_com.valid_com FROM
> (blg_comment_com INNER JOIN blg_user_usr ON
> blg_user_usr.id_usr=blg_comment_com.idusr_com) WHERE
> blg_comment_com.idart_com=%s AND blg_comment_com.valid_com=1 ORDER BY
> date_com ASC", $KTColParam1_rsComments);
> $rsComments = mysql_query($query_rsComments, $connBlog) or
> die(mysql_error());
> $row_rsComments = mysql_fetch_assoc($rsComments);
> $totalRows_rsComments = mysql_num_rows($rsComments);
>
> attempt 2:
> mysql_select_db($database_connBlog, $connBlog);
> $query_rsComments = "SELECT idart_com, COUNT(id_com) FROM
> blg_comment_com GROUP BY idart_com";
> $rsComments = mysql_query($query_rsComments, $connBlog) or
> die(mysql_error());
> $row_rsComments = mysql_fetch_assoc($rsComments);
> $totalRows_rsComments = mysql_num_rows($rsComments);
>
> I am trying to have a field in my main page that says 'comments(some
> number)'. Right now it says only 'comments'. I know one thing about the
> two attempts above, my problem is on the line of $query_rsComments and
> the commands placed to the database. Totaling up the values for
> $totalRows_rsComments and everything else I can do, but I'm not getting
> correct response from the base. What is the correct communication for
> the tables, or where am I going wrong with the two above attempts?
>
> Thank you,
> -Patrick
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>

This is not a MySQL related problem, more a PHP one. Check this:
http://www.php.net/manual/en/function.mysql-num-rows.php

--
Daniel da Veiga
Computer Operator - RS - Brazil
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/IT/P/O d-? s:- a? C++$ UBLA++ P+ L++ E--- W+++$ N o+ K- w O M- V-
PS PE Y PGP- t+ 5 X+++ R+* tv b+ DI+++ D+ G+ e h+ r+ y++
------END GEEK CODE BLOCK------

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to