RE: hotornot functionality

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



i would do it totally different

if i understand you right.. you start with row number one, show it, give it
a rate, then show number 2, and show number 1 as last rated pic!!!

then you have the problem of reaching the last record!!

but !! i also see another problem:

if you do row 1,2,3,4  you always gets the first image , then the second etc
etc

what I would do:

take a random picture from the mysql table (you can use the mysql random
functin within a query for it)

then show this one!

give it a rate

then after rating it, put it in an array

then do a new random query but use the 'not in' function and don't select
the numbers what are in the array!!

so you get a new picture!

and the last rated pic is the picture at the last place in the array so you
can show it...

and when the array has equal number of rows as the table has, you showed
them all and you empty the array so they can start over

you get my point ? (sorry for my bad english)

how about this idea?

greeting , mark

-----Original Message-----
From: Matthew Horn [mailto:mhorn@macromedia.com]
Sent: woensdag 28 mei 2003 14:56
To: php-db@lists.php.net
Subject:  hotornot functionality


I am toying with the idea of implementing functionality similar to the
hotornot.com site -- for a different purpose, mind you, but the same kind of
user experience. Here's what it does: 

1. A picture is served up.
2. User clicks on a radio button scale from 1 to 10 to "rate" the picture.
3. The page refreshes. The rating is re-computed with the user's rating for
the original picture. The original picture becomes that "last rated" pic,
and a new one is served up. 
4. The user can cycle through as many pictures this way as they want.

I have MySQL and PHP to work with.

What I am trying to do is figure out the best approach to implementing it.
Specifically, when the user clicks on the radio button, that triggers the
form submit via JavaScript. The form submit updates the database with the
rating and then fetches the next row.

The problem that occurred to me as I was putting together a prototype is:

I don't want the user to get the entire result set of all the images in the
database at once. I really want them to get just the two images (the one
they just rated and the one they are about to rate). Is there a way to
"remember" the last row they selected and then use that number to fetch the
next one on the subsequent request? I can keep recycling hidden form fields
with a number, which should work ok, but the problems come up when they
reach the last row.

Anyway, just looking to see if you folks have some ideas. I would prefer to
roll my own rather than use one of the available "hotornot-style" PHP
scripts to do this.

--------

Matthew J. Horn

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux