Whats Better Script
Moderator: General Moderators
Whats Better Script
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.

- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
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.
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.
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
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
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
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
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
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
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.
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
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
Also the tuts at PHPFreaks.com are pretty good
ok with a little help from a friend I created a script
index.php
vote.php
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
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.
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>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!";
}
?>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!";
}
?>u can see it at http://www.modifiersonline.com/test/
I hope now u guys can help me figure this thing out.