Some Code Wanted Please

Started on the old forum in June 2007 · view the original in the archive · old links redirect here

6 replies · 650 views · started 19 years ago · 1 min read

5 participants
nclemale36 Lead · 537 posts #1

hi. been trying to do this myself for days . i get to a stage then it goes no further so am asking for proffesional help . i have a mysql database and i want to put on my site the last forum post on my main welcome page and make it a link so ppl can go straight to it instead of clicking to go to forum then to a certain forum then to find that post.

i know its probably only 4 or 5 lines of code but its doing my head in lol.

so if anyone can help i be much obliged .

amylee Principal · 1,092 posts #2

its more like 1 line of code its somewhere in here in a thread called lavalair script mods or something search for that

alesh Lead · 604 posts #3

if its 4 lava i posted tht code sumwhr at this forum.... dnt knw at wich topic thou.... search lil bit

eeeeerrr....

WhiteWarrior Principal · 1,419 posts #5

$result = mysql_query("SELECT * FROM forumindex"); $forum = mysql_num_rows($result);

put the code like

$result = mysql_query("SELECT * FROM forumindex"); $forum = mysql_num_rows($result); echo " <a href="forum.phpusername=$username&password=$password">-forums ($forum)-</a>"; or how ever your links are

Guest #7

this is untested so i dont know if it will work as it is now, but it basically orders all the topic titles by the 'time' and limits how many it will show by 1

it then defines $ttitle and $tid simply because it is easier to follow what happens and are not neccessary

the link is then just filled in with the information

as i said before, this probably isnt correct code, but hopefuly it gives you an idea of the processes needed to do what you need to do .. ?

$last_post = mysql_fetch_array(mysql_query("SELECT title, id, time FROM `topics` ORDER BY time desc LIMIT 1"));

$ttitle = $last_post[0];
$tid = $last_post[1];

echo "<a href=\"forum.php?topic=$tid&username=$username&password=$password\">$tid</a>";

EDIT: sorry .. had an extra line of code that i accidentally forgot to remove .. all done now =]

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close