Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Need help with shoutbox

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Need help with shoutbox

Postby vahn » Thu Oct 17, 2002 12:39 pm

Hey everyone, my names Nick, or vahn or whatever you'd like.

Im currently writing a some what simple script for my freind's website.
Its called a shoutbox, and for those of you who havnt heard of them, they are like small message boards. They are for short comments that are posted on the main page of a website.

For a working example of a shout box, check out http://www.wastedyouth.org the shoutbox is called 'youth yak' on the right side at the bottom.

My problem is, I want to limit the number of posts to be shown at a time. Instead of having a page full of 60 shouts. I cant figure out how to make the script check to see if there are more than the set amount of shouts. And if their are , to delelte the neccessary amount of old shouts.

Another problem is, i am using RSORT(reverse sort) function, to arrange the shouts from top to bottom. It was working fine, until recently, now it arrangers them in alphabetical order, then reverses the list. Any help?

Here is a link to a .txt file so you can view the source code. (sorry if its sloppy, i need to get in the habbit of adding comments).
http://bhg.port5.com/index.txt

And here is a link to the beta version of the working source code I am working on.
http://bhg.port5.com/index.php

Please let me know what you think, and any comments you might have, thanks!
vahn
New php-forum User
New php-forum User
 
Posts: 5
Joined: Thu Oct 17, 2002 12:25 pm

Postby Jay » Thu Oct 17, 2002 12:49 pm

Your script wouldn't load for me, but if you are using a MySQL database you can use the limit syntax at the end of your script.
$query = "select * from table limit 5,20
5 = starting row
20 = rows to return
Jay
 

Re: Need help with shoutbox

Postby mjr » Fri Oct 18, 2002 10:42 am

try to use foreach() instead of for(). it might help
mjr
New php-forum User
New php-forum User
 
Posts: 18
Joined: Fri Sep 27, 2002 6:35 am


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.