Jump to content

Archived

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

SieRobin

Forums [HELP!]

Recommended Posts

I'm making a forum for my website, and for each idividual user, I'd like them to have their own Quote at the end of every post. I really don't want to log the quote in every post every singly time the user actually posts something.

How can I just make it only retrieve that persons quote instead of just the first users quote in the query? If you don't understadnd what I mean, I can elaborate.

Share this post


Link to post
Share on other sites
[!--quoteo(post=354295:date=Mar 12 2006, 03:47 PM:name=Christopher Robin)--][div class=\'quotetop\']QUOTE(Christopher Robin @ Mar 12 2006, 03:47 PM) [snapback]354295[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I'm making a forum for my website, and for each idividual user, I'd like them to have their own Quote at the end of every post. I really don't want to log the quote in every post every singly time the user actually posts something.

How can I just make it only retrieve that persons quote instead of just the first users quote in the query? If you don't understadnd what I mean, I can elaborate.
[/quote]


I do understand what you are talking about, however the answer would depend on how you have your DB tables setup (assuming MySQL here).

For instance:

<?php

//Do database connection first

$sql = mysql_query("SELECT * from quote_table");

$row = mysql_fetch_array($sql);

var_dump($row);

echo $row['column_name'];

?>

The above would dump & echo the first row that it encountered in the table


<?php

//Do database connection first

$sql = mysql_query("SELECT * from quote_table WHERE userid='$user_id'");

$row = mysql_fetch_array($sql);

var_dump($row);

echo $row['column_name'];

?>

The above would dump & echo the row in the table WHERE userid=$user_id. It also assumes that there is a unique "something" in the row with the quote that can be matched up with the currently logged in user. I assume you are tracking by $_SESSION or $_COOKIE.

Share this post


Link to post
Share on other sites
Ok there are many users on the website. For each quote to be posted, it has to select the person from the database, not just the first person.

[code]<?php

//Do database connection first

$sql = mysql_query("SELECT * from quote_table WHERE userid='$user_id'");

$row = mysql_fetch_array($sql);

var_dump($row);

echo $row['column_name'];

?>[/code]

This would be ok, if I knew what to define the user ID as, correct? You can't associate the correct ID everytime with the post that has been submitted. Here's the scenario.

You have the author's name. The title, the actual post.. and under the post you have the quote, which is like a signature. Instead of having it take it from the users table in the database then inserting it into the the f_post table in the databse, and having an extra line everytime you post a reply, is there a way i could just have it take it right from the users table and post it?

Share this post


Link to post
Share on other sites
[!--quoteo(post=354349:date=Mar 12 2006, 06:22 PM:name=Christopher Robin)--][div class=\'quotetop\']QUOTE(Christopher Robin @ Mar 12 2006, 06:22 PM) [snapback]354349[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I believe I've got it, thank you anyhow :]
[/quote]

Yes, Instead of inserting it into the post you could do this:

When the post is displayed by whoever, have PHP look-up the post creator and just dynamically insert the signature.

That's as helpful as it gets without knowing tables / column / db names

Share this post


Link to post
Share on other sites

×

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.