Jump to content

pulling up user stats


dadamssg

Recommended Posts

i posted this in the mysql board but i think its more of a php question now...im fetching forum topics and outputting their username, topic title, the description, the id#, etc. i have a table for topics and then a table for member info/stats. i am currently displaying the topics and the replies. the replies have their username, id#, and the actual reply.but i want to pull up the member stats kind of like this forum, shows their number of posts etc. And put those under the repliers username...heres what i have that pull up the topic info and the replies

 

<?php
$quer = "SELECT * FROM test WHERE post_id = $postid";

$rsult = mysqli_query($cxn,$quer)
             or die ("Couldn't execute");
$row = mysqli_fetch_assoc($rsult);

//get replies
$quu = "SELECT * FROM Replies WHERE postid = $postid ORDER BY time ASC";
$res = mysqli_query($cxn,$quu)
            or die ("Couldn't execute");

and heres how i output it

<?php
echo "<h1><center><u>{$row['title']}</u></center></h1><br><br>";
echo "<center><table border=7>";
echo "<tr><td>Post ID:</td><td>{$row['eventid']}</td></tr>";
echo "<tr><td>Created By:</td><td>{$row['createdby']}</td></tr>";
echo "<tr><td>Title:</td><td>{$row['title']}</td></tr>";
echo "<tr><td>Description:</td><td>{$row['description']}</td></tr>";
echo "</center></table><br><br>";

while($ric = mysqli_fetch_assoc($res)){
$reply = nl2br($ric['reply']);
echo "<center><table border=5 width=500 cellpadding='50'>";
echo "<tr><td width=70>Reply Id:</td><td>{$ric['replyid']}</td></tr>";
echo "<tr><td>Posted:</td><td>{$ric['time']}</td></tr>";
echo "<tr><td>Posted By:</td><td>{$ric['createdby']}</td></tr>";
echo "<tr><td><center>Reply:</center></td><td>{$reply}</td></tr>";
echo "</center></table><br><br>";

}

 

how would i do a foreach loop or something of that effect to pull up their stats in my Member table?

Link to comment
https://forums.phpfreaks.com/topic/153095-pulling-up-user-stats/
Share on other sites

'test' table contains the topics....it has an id number, who created it, the date it was created, the title, and the input they put in the textbox(description...i guess youd call it). the replies table has the post id(the id number corrosponding to the right topic, the reply id, datetime it was created, the username who wrote the reply, and then the reply itself....i want to pull info from my Member table, which has username, first,last name, password, confirm hash, date created, # of topics started, # of replies to topics. soooo based on all that i want the replies in an html table, with who posted it(username), when, its reply id number and then i want to put under their username those 2 stats form my Member table(# of topics started and # of replies)...the below code outputs the starting topic, then all the replies and the data about each reply(username, when, id#, etc) but i don't know how to query my Member table for the individual stats to display under the username next to their reply....does that clarify at all?

 

so this is what it looks like now

 

Username  |  replyid  |  created |

Billy Bob    |  423      | April 4, 2009 12:14 pm

 

 

and what i want it to be like...

 

Username  |  reply id  | created

 

Billy Bob

Posts:24    |  423        | April 4, 2009 12:14 pm

Replies:64  |

 

just don't know how to grab those stats from my Member table for each username for each reply

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.