Web Hosting Talk







View Full Version : you probably won't believe this


DivaX007
08-28-2002, 05:11 PM
ok. i'm working on my first (soon to be) live site. (i don't have much experience).
i want users to be able to rate pictures on the site and get an accurate count of the votes for each picture. the user also will earn points for coming to the website.
what do i need to learn? (with a GOOD learning curve).

thanks in advance.

steve93138
08-28-2002, 05:18 PM
Originally posted by DivaX007
ok. i'm working on my first (soon to be) live site. (i don't have much experience).
i want users to be able to rate pictures on the site and get an accurate count of the votes for each picture. the user also will earn points for coming to the website.
what do i need to learn? (with a GOOD learning curve).

thanks in advance. Personally, I would use a MySQL database for storing information about each user. So one thing you would need to learn would be how to access MySQL via PHP.

Studio64
08-28-2002, 11:48 PM
Well.. Your in the right forum so thats your first start..
I'd suggest finding a few books about PHP & MySQL..

Basic format:
Display photo.
Ask Hot? (Y/N)
Record Results.

So you want a table like this in MySQL.

Photos.

int -> Photo
text -> Filename
int -> Score


So you'd display a page like this

<?
mysql_connect( // connetion information);
$res = mysql_query("SELECT * FROM Photos ORDER BY RAND() LIMIT 1");
$row = mysql_fetch_array($res);
$photo = $row["filename"];
$id = $row["ID"];
?>
<html>
<center>
<img src="<?echo $photo?>"><br>

<a href="vote.php?id=<?echo $id?>&vote=yes">Yes</a>
<br>
<a href="vote.php?id=<?echo $id?>&vote=no">No</a>
</center>
</html>

The vote.php would UPDATE the Photo table score either +1 or -1 depending on the vote. Then you could refernce the table again on who's photo has the highest score etc...

Once you understand the basics of PHP & MySQL the rest is quick and simple... I just wrote this on the fly with some time you could make a very advanced version of this.

BTW... I've been drinking... So please don't tear apart my code. :D

anantatman
08-29-2002, 12:28 AM
if you want to get started fast.. do a search for "amigeekornot"

on google.. its an open source website for rating pictures, etc..

you could use a lot of the source code on there.

Studio64
08-29-2002, 02:05 AM
Originally posted by anantatman
if you want to get started fast.. do a search for "amigeekornot"

on google.. its an open source website for rating pictures, etc..

you could use a lot of the source code on there.

or

http://www.amigeekornot.com/



:D

anantatman
08-29-2002, 02:50 AM
haha yeah, didn't quite link those in my head there, thanks

DivaX007
08-29-2002, 01:26 PM
thanks SOOOO much, guys. especially studio64!:D