Advertisement

01.11.2007 at 05:21AM PST, ID: 22118936
[x]
Attachment Details

Php Mysql count rows function.

Asked by Toube in PHP and Databases

Tags: , , ,

Hi,

I have this sql_query code on my message board front page:

$amount = mysql_query("SELECT p.*, t.ID FROM posts p, topics t WHERE p.TopicID=t.ID");
$num_rows = mysql_num_rows($amount);

and to print it out I have the <?php echo $num_rows ?>

The 2 tables looks the following way:
Table posts:

ID int(5) PRI NULL auto_increment
TopicID int(5) 0       
timestamp timestamp(14) YES NULL       
user_ varchar(10) YES NULL       
Post text

Table topics

ID int(5) PRI NULL auto_increment
TopicName varchar(50)

and what I'm trying to achieve is to display the amount of posts each topic holds, but with that current search it displays the amount of all the posts made..

any ideas?

Thanks,

-T

                 

                               

Start Free Trial
[+][-]01.11.2007 at 05:24AM PST, ID: 18292218

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.11.2007 at 05:24AM PST, ID: 18292219

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.11.2007 at 05:33AM PST, ID: 18292297

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.11.2007 at 05:35AM PST, ID: 18292319

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.11.2007 at 05:41AM PST, ID: 18292366

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.11.2007 at 05:53AM PST, ID: 18292445

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.11.2007 at 06:37AM PST, ID: 18292764

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.11.2007 at 06:55AM PST, ID: 18292939

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.11.2007 at 10:22AM PST, ID: 18295100

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PHP and Databases
Tags: mysql, count, php, rows
Sign Up Now!
Solution Provided By: TeRReF
Participating Experts: 2
Solution Grade: A
 
 
[+][-]01.11.2007 at 11:02AM PST, ID: 18295460

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.12.2007 at 12:29AM PST, ID: 18299705

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32