-Patrick schrieb:
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";
this looks right so far
$rsComments = mysql_query($query_rsComments, $connBlog) or
die(mysql_error());
$row_rsComments = mysql_fetch_assoc($rsComments);
$totalRows_rsComments = mysql_num_rows($rsComments);
Please. It will be a lot easier without the PHP around it when you post
a MySQL related Problem.
Most people here are coding in JAVA for example and don't get those
functions at all.
What does echo $totalrows_rscomments give?
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?
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]