Jump to content


Photo

Forums [HELP!]


  • Please log in to reply
4 replies to this topic

#1 SieRobin

SieRobin
  • Members
  • PipPipPip
  • Advanced Member
  • 212 posts
  • LocationNew Jersey

Posted 12 March 2006 - 08:47 PM

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.

#2 phporcaffeine

phporcaffeine
  • Members
  • PipPipPip
  • Advanced Member
  • 361 posts
  • LocationOhio, USA

Posted 12 March 2006 - 09:11 PM

[!--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) View Post[/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.
Thanks,

Ryan Huff
President & Founder, MyCodeTree
support@mycodetree.com | http://mycodetree.com

#3 SieRobin

SieRobin
  • Members
  • PipPipPip
  • Advanced Member
  • 212 posts
  • LocationNew Jersey

Posted 12 March 2006 - 11:04 PM

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.

<?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'];

?>


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?

#4 SieRobin

SieRobin
  • Members
  • PipPipPip
  • Advanced Member
  • 212 posts
  • LocationNew Jersey

Posted 12 March 2006 - 11:22 PM

I believe I've got it, thank you anyhow :]

#5 phporcaffeine

phporcaffeine
  • Members
  • PipPipPip
  • Advanced Member
  • 361 posts
  • LocationOhio, USA

Posted 13 March 2006 - 05:11 AM

[!--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) View Post[/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
Thanks,

Ryan Huff
President & Founder, MyCodeTree
support@mycodetree.com | http://mycodetree.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users