Closed Thread Icon

Preserved Topic: mysql_fetch problem... (Page 1 of 1) Pages that link to <a href="" title="Pages that link to Preserved Topic: mysql_fetch problem... (Page 1 of 1)" rel="nofollow" >Preserved Topic: mysql_fetch problem... <span class="small">(Page 1 of 1)</span>\

Nervous Wreck (II) Inmate

From: Sweden
Insane since: Nov 2001

posted posted 11-27-2001 09:34

Hey !
Im trying to post the 3 latest topics, from my msg board
to the frontpage of my site...

how can i do this ?


-> .A. <-

Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 11-27-2001 12:36

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Nervous Wreck (II) Inmate

From: Sweden
Insane since: Nov 2001

posted posted 11-27-2001 17:08

hehe.. ye abit cryptic maybe =)

what I want:
I want to get the 3 latest message topics, from my message board, on the main page...

a mysql script that gets the 3 latest written "topic" posts from the forum database.

hmm I think that made sence !? =)

the url btw is : the Forum is @ the "Board" link in top meny
( ! its under heavy reconstrution ! )

-> .A. <-

[This message has been edited by Air (edited 11-27-2001).]

Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 11-27-2001 17:22

Air: Welcome. I'm sure one of the experts will jump in and offer the correct solution but the way I'd do it, off the top of my head is: Do a sort of topics ORDER BY date DESC, grab the id and name (and pos. the name of the person who posted the message if you want) and then use a counter++ so that as you loop through you know when you've reached 3 - hold up I'd just throw a LIMIT 3 into the MySQL statement so that all the work is done by the MySQL (much quicker).

There is pos. something wrong there but that is my quick sketch solution.


[edit: So it was in English sentences rather than gobbledegook!!]

You're my wife now Dave

[This message has been edited by Emperor (edited 11-27-2001).]

Paranoid (IV) Inmate

Insane since: Apr 2000

posted posted 11-27-2001 17:36

Emperor knows of what he speaks. What I do is
$myquery = "select * from <table> order by <date field> DESC limit 3"

Or, taking a lesson from the master (Mr. Max):
Limit optimization
Sorting rows
Select syntax

Nervous Wreck (II) Inmate

From: Sweden
Insane since: Nov 2001

posted posted 11-27-2001 18:09

aah.. my deepest thank you's !

it works !

atleast on localhost =)

*im so happy*

-> .A. <-

Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 11-27-2001 21:30

BTW, we can usually give you more exact solutions to this kind of problem if you post your table structures.


« BackwardsOnwards »

Show Forum Drop Down Menu