Forum Moderators: coopster

Message Too Old, No Replies

Very challenging question about stats

         

testing0

10:24 am on Oct 6, 2006 (gmt 0)

10+ Year Member



Hi,

well here we go hope I can explain well what i want to ask.

I want to make a short stats about my members so that it show near there signature.

$c = mysql_query ("select * from user");
$d= mysql_fetch_array($c);

$name= $d["user"];
$gender= $d['gender'];
$city= $d["city"];

echo $name."<br>".$gender."<br>".$city;

How to make the script understand to show that result about each member?

any help would be appreciated

omoutop

10:36 am on Oct 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Define a single element that its unique to each user (some id, or email or whatever else)

So for the email make you SELECT statement like this
Select * From {table} WHERE {email-field}='$user_email'.

That way you will select only 1 row from your database and you will show the appropriate values in your page

testing0

10:40 am on Oct 6, 2006 (gmt 0)

10+ Year Member



Hi, thanks for reply.

But in 1 topic there are 10 replies and all replies from diffrent users.

So that script should show 10 diffrent stats.

If i define in a variable something like

$id = $_GET['id'];

it may show on all posts the same stats?

eelixduppy2

10:55 am on Oct 6, 2006 (gmt 0)

10+ Year Member



I'm under the impression that you are going to be adding these stats to the end of a message at the time the user submits the text--just concatenate it to the end. If you are going to retrieve the info each time the page is viewed, then it's not going to be very efficient. omoutop's solution above will work correctly, but you aren't just limited to using an email address in your WHERE clause.

Good luck!

FiRe

2:49 pm on Oct 6, 2006 (gmt 0)

10+ Year Member



$c = mysql_query ("select * from user");
while ($d= mysql_fetch_array($c)) {

$name= $d["user"];
$gender= $d['gender'];
$city= $d["city"];

echo $name."<br>".$gender."<br>".$city;
}