php
<?php
function incVote()
{
mysql_query("UPDATE quotes SET votes=votes+1 WHERE quote=$quote") or die(mysql_error());
}
function decVote()
{
echo $row['quote'];
mysql_query("UPDATE quotes SET votes=votes-1 WHERE quote=$quote") or die(mysql_error());
}
$conn = mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("sqldb") or die(mysql_error());
if (!($db = sqlite_open('sqldb/quotes', '0666'))) {
echo "<h2>".$TEXT['ERROR']."</h2>";
die;
}
$result = mysql_query("SELECT quote FROM quotes ORDER BY votes DESC")
or die(mysql_error());
echo "<table border='1'>";
echo "<tr><th>Position</th><th>Quote</th><th width='2'>Vote</th>";
$i = 0;
while ($row = mysql_fetch_array($result)) {
$i++;
echo "<tr class='style1'><td>";
echo $i;
echo "</td><td>";
$quote = print $row['quote'];
echo $quote;
echo "</td><td>";
mysql_query("UPDATE quotes SET votes=votes+1 WHERE quote=$quote") or die(mysql_error());
?>
HTML
<input name="plus" type="image" src="../images/plus.gif" onclick="alert('Thank You for Voting'); return false" />  
<input name="minus" type="image" src="../images/minus.gif" onclick="alert('Thank You for Voting'); return false" />
php
<?php
}
echo "</table>";
?>
//I want the user to be able to click on the image and it would call the function to modify a SQL table,
//which inc/dec the votes.
//do not know which language would be the best, but could not get the input to work in the PHP
EDIT: Code blocks added, please use them in the future =>
This post has been edited by PsychoCoder: 27 Apr, 2008 - 07:14 PM