我有一个执行两个 php 文件的 html 文件(竖起大拇指/竖起大拇指的测试页)...一个用于竖起大拇指,一个用于竖起大拇指。
我现在需要做的是将此代码插入页面(辩论状态辩论列表),以便可以对每个辩论标题进行排名并相应地上下移动。
和我一起工作的朋友已经完成了大部分编码工作,包括 PHP 和表格。
我的问题是:有没有办法在页面上的每个辩论标题旁边竖起大拇指,竖起大拇指?到目前为止,我得到的最好的结果是在桌子上方竖起/向下竖起大拇指。
//test.html
<html>
<body>
<a href="upvote.php" onClick="alert('You have given this item a thumbs up! You can change
your vote, or leave it how it is.')"; onMouseOver="return changImage()" onMouseOut=
"return changImageBack()" ><img
name="jsbutton2" src="Graphics/thumbs-up-unclicked.jpeg" width="75" height="75" border="0"
alt="javascript button"></a>
<script type="text/javascript">
function changImage()
{
document.images["jsbutton2"].src= "Graphics/thumbs-up.jpeg";
return true;
}
function changImageBack()
{
document.images["jsbutton2"].src = "Graphics/thumbs-up-unclicked.jpeg";
return true;
}
</script>
<a href="downvote.php" onClick="alert('You have given this item a thumbs down! You can change your vote, or leave it how it is.')"; onMouseOver="return changeImage()" onMouseOut= "return changeImageBack()" ><img
name="jsbutton1" src="Graphics/thumbs-down-unclicked.jpeg" width="75" height="75" border="0"
alt="javascript button"></a>
<script type="text/javascript">
function changeImage()
{
document.images["jsbutton1"].src= "Graphics/thumbs-down.jpeg";
return true;
}
function changeImageBack()
{
document.images["jsbutton1"].src = "Graphics/thumbs-down-unclicked.jpeg";
return true;
}
</script>
</body>
</html>
//upvote.php
<?php
session_start();
?>
<?php
$server = "X";
$dbusername = "X"; //database username
$dbpassword = "X"; //database password
$dbdatabase = "X"; //database name
$sqlconnect = mysql_connect($server, $dbusername, $dbpassword) or die("Couldn't connect to SQL Server on $server");
$sqldb = mysql_select_db($dbdatabase,$sqlconnect) or die("Couldn't open database $dbdatabase");
$sql="INSERT INTO Votes (UID, date, rating)
VALUES
('{$_SESSION['UID']}', CURDATE(), 1)";
if (!mysql_query($sql,$sqlconnect))
{
die('Error: ' . mysql_error());
}
mysql_close($sqlconnect);
?>