Guestbook

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bajaber
Forum Newbie
Posts: 6
Joined: Thu Apr 15, 2004 1:11 pm

Guestbook

Post by bajaber »

Am designing a guestbook i would like somebody to help on how to view all the people who have signed my guestbook, and the view page should be divided into only 5users on each page.......pls help
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

u need to be more specific.

cant say build me a vechicle and hope someone makes you a truck instead of a go-kart.

What sources do you have? MySQL database? so forth
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

do a search on pagination..

do people have an account to sign your guestbook?
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

Code: Select all

mysql_query"SELECT DISTINCT username FROM guestbook WHERE username <> 'Guest'");
Last edited by malcolmboston on Fri Apr 16, 2004 8:29 am, edited 1 time in total.
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

malcolmboston wrote:

Code: Select all

mysql_query("SELECT DISTINCT (username) FROM guestbook WHERE username <> 'Guest'");
i've never seen "DISTINCT (username)" before, could you tell me what it does?
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

my bad, i edited it

im pretty sure you know what distinct is used for........
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

DISTINCT will (not suprisingly) return distinct occurences in a result set. For example, the master_name table has more than one person with the last name Smith. If you wanted to select last names without repeating results you would use DISTINCT.

Mark
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

the reason i did it that way was so that if a user name John Smith had made 50 messages it would only retrieve his name once instead of every instance he had posted a message
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

ahh, i didn't know :?
thanks :D , now i'm a little better at MySQL :D :wink:
bajaber
Forum Newbie
Posts: 6
Joined: Thu Apr 15, 2004 1:11 pm

Post by bajaber »

tim wrote:u need to be more specific.

cant say build me a vechicle and hope someone makes you a truck instead of a go-kart.

What sources do you have? MySQL database? so forth
.................................................
Thanx alot tim.

as said i wanted to make a guest book, i do use Mysql database, i want wen somebody click on the submit button, then all his info(entry) will be posted and stored in my database.........
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Don't reinvent the wheel.

http://www.hotscripts.com/PHP/

I'm sure there are hundreds of them out there.
Image Image
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

more like thousands :P :wink:
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

phice wrote:Don't reinvent the wheel.
lol, i always try to prevent this, i dont really think you learn if your using other peopls scripts, how can you fully understand the in's and out's of it?

personally i always do everything myself i have a couple of hotscripts app's sitting on my drive at home, so i can take a gander at how exactly somehing is done (how i learnt file directories) but the reason i "know so much after so little time" is because i type my app's up from scratch therefore forcing me to undersand the terminology i am using

just my $0.02
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

malcolmboston wrote:
phice wrote:Don't reinvent the wheel.
lol, i always try to prevent this, i dont really think you learn if your using other peopls scripts, how can you fully understand the in's and out's of it?
Heh...
Youre not supposed to take a pre-existing script, modify it and use that. You still of course should read up on the things you do not understand, so the "dont reinvent the wheel" comments is still legit.

I do think that looking at other peoples code (understanding it or not) is the best way to get a hang of something, just aslong as you research it before applying it.
Post Reply