Page 1 of 2
Whats Better Script
Posted: Sat Feb 14, 2004 5:11 pm
by timka
Hello Im new here, and I was looking for this one scripts for few months now with out any luck, I don't really know the name of the script, but u can see the example at
http://www.whatsbetter.com or
http://www.bootyvote.com 18+ if anyone knows the name of the script or knows where can I download it please help me out. I relly need this script and I've lost any hope on other boards so I came to PHP proffecionals with one last hope.

Posted: Sat Feb 14, 2004 5:12 pm
by timka
It doesn't have to be a fancy one all I want is people to vote between two images for a better one.
Posted: Sat Feb 14, 2004 5:25 pm
by DuFF
Posted: Sat Feb 14, 2004 5:26 pm
by John Cartwright
Posted: Sat Feb 14, 2004 5:46 pm
by timka
did u guys looked at examples I need something like that where u get to choose one picture from two. and I've looked all over hotscripts.com I looked before I asked.
Posted: Sat Feb 14, 2004 5:57 pm
by mikusan
We can help you with the script, but you will have to have the determination to learn php on your own to achieve this. This is not a difficult script, but to try to get something like this working when you have no knowledge of PHP then that's a different story.
Posted: Sat Feb 14, 2004 6:03 pm
by timka
Im willing to learn. im very new with php.
Please help me find the script I've looked every were I could. PLEASE
Posted: Sat Feb 14, 2004 6:21 pm
by mikusan
I don't know of any scripts out there. But this seems like a minor thing, that i would prefer to code myself.
I can point you in the right direction.
First you probably want to set up a database. This is your base data structure, everything will be stored here.
Now, you need a basic page where you show two pictures.
Whatever you choose, then a field (radio button) within a <POST> field.
You will catch the <POST> variables to determine which radio button has been pressed, and from that, you load the result in the database.
Then you will have to decide some way to block the person from voting again, or you don't care.
Once you have done this, you will have to think about how you are going to manage many of these voting pictures processes.
Now, it's all about figuring out what you need, and how to implement it.
Posted: Sat Feb 14, 2004 6:47 pm
by d3ad1ysp0rk
It's just a basic voting script, using links instead of forms, and only two options.
img 1 links to: site.com/page.php?id=54&vote=1
img 2 links to: site.com/page.php?id=54&vote=2
This just says "hey page, this is the 54th poll, and they voted for number $vote!"
if its 1, it increments the db value for 1.. well.. +1
if its 2, it increments the db value for 2, +1
the front page is probably a random poll?
just use the random function with mysql_num_rows as the highest number
Posted: Sat Feb 14, 2004 6:55 pm
by timka
man u guys make it sound so easy. but for a complite nOOb its very hard to even understand could any of maybe make one for me? Il'' give u credit for it on my site. or maybe we can work something out. JUST PM me if ur up for it.
Posted: Sat Feb 14, 2004 6:59 pm
by d3ad1ysp0rk
the only reason it took us a few seconds to respond is because its just text, not code.
i wish psuedo code worked in php
you're going to have to learn it and use what we said as a reference if you're stuck on what to do next.
and if you have any questions, be sure to post here, we'll be more than happy to answer them, but this isnt a 5min script, so you'll have to do it yourself
good luck

Posted: Sat Feb 14, 2004 7:13 pm
by timka
I know I have to learn, but first I have to start with simple stuff, but goin from nothing to making a image gallery. thats not possible so thats where I ask for help from pros. I know when u guys were starting u didn't just go on to creating big stuff u went to colleges or read books, and im just starting with PHP I don't even have a single book about it.
Posted: Sat Feb 14, 2004 8:02 pm
by d3ad1ysp0rk
Posted: Sat Feb 14, 2004 10:38 pm
by Illusionist
like LiLpunkSkater pointed out, look over some tutorials. w3schools is really good, but i the php
manual would be a lot of help....
Also the tuts at
PHPFreaks.com are pretty good
Posted: Sun Feb 15, 2004 1:42 pm
by timka
ok with a little help from a friend I created a script
index.php
Code: Select all
<table width="100%"><tr><td width="50%">
<form action="vote.php" method="post">
<img src="images/image1.jpg"><br>
<input type="radio" name="image" value="image1">
</td>
<td width="50%">
<img src="images/image2.jpg">
<input type="radio" name="image" value="image2">
</td></tr>
<tr><td width="100%" align="center"><input type="submit" value="Vote!" name = "submit"></td></tr></table>
vote.php
Code: Select all
<?
//connect to db with remote file
include('dbinfo.inc.php');
//end connect to db
if($image='image1'){
mysql_query("INSERT INTO tablename (image) VALUES ('$image')") or die(mysql_error());
$query = "SELECT * FROM tablename WHERE image='$image'";
$num = mysql_num_rows($query);
echo " You vote for $image . It has been voted for $num times!";
} else {
$image = 'image2';
mysql_query("INSERT INTO tablename (image) VALUES ('$image')") or die(mysql_error());
$query = "SELECT * FROM tablename WHERE image='$image'";
$num = mysql_num_rows($query);
echo " You vote for $image . It has been voted for $num times!";
}
?>
that is the original script I asked for help because it was giving me this error Table 'modifie_test.tablename' doesn't exist
the guy told me that I have to create table in phpMyAdmin so I did
in My Admin I created three tables
Votes
image
imageSrcPath
inside tabke Votes
voteID mediumint(9) No auto_increment
imageID mediumint(9) No 0
voteDate datetime No 0000-00-00 00:00:00
inside table image
imageID mediumint(9) No auto_increment
voteID mediumint(9) No 0
voteDate datetime No 0000-00-00 00:00:00
inside table imageSrcPath
imageSrcPath varchar(255) No
is this correct?
if yes why is the page blank or do I have to make any images?
I also edited the original script to this
Code: Select all
<?
//connect to db with remote file
include('dbinfo.inc.php');
//end connect to db
if($image='image1'){
mysql_query("INSERT INTO Votes (imageID) VALUES ('$_POSTїimageID]')") or die(mysql_error());
$query = "SELECT * FROM Votes WHERE imageID='$image'";
$num = mysql_num_rows($query);
echo " You vote for $image . It has been voted for $num times!";
} else {
$image = 'image2';
mysql_query("INSERT INTO Votes (imageID) VALUES ('$_POSTїimageID]')") or die(mysql_error());
$query = "SELECT * FROM Votes WHERE imageID='$image'";
$num = mysql_num_rows($query);
echo " You vote for $image . It has been voted for $num times!";
}
?>
and now the page comes up blank
u can see it at
http://www.modifiersonline.com/test/
I hope now u guys can help me figure this thing out.