Okay so my code below echoes out two URLs from the database but I want to have the ability to separate the two and update the row where the image is clicked. Example: Two images are output, users clicks image on the left, MySQL knows which row to update depending on which image they clicked. Depending on the image they click it will update the image's votes in MySQL. Ideally I want the "vote-ups" to show in place of the 112 and 156 accordingly from the database.
Let me rephrase to clarify: my code echoes out two images selected from the database. The code should tell you that if you read it. From there, I want to be able to separate the two images so I can do a query to update the specific row with that image and update the total votes that image has from votes
to votes
+1. I tried doing this but it would update both row's votes by 1.
How can I do this?
<?php
include_once('db.php');
$selectURLSQL = "SELECT * FROM `urls` ORDER BY RAND() LIMIT 3";
$selectURLQuery = mysql_query($selectURLSQL);
$URL_Row = mysql_fetch_array($selectURLQuery);
?>
<?php
while($URL_Row = mysql_fetch_array($selectURLQuery)) {
?>
<img class="img" name="img" src="<?php echo $URL_Row['url']; ?>" style="height:400px;width: 260px;">
<?php
}
?>
<br /><br />
<span style="font-size:18px;font-family:trebuchet ms;">156 Vote-Ups</span>
<small>Vs.</small>
<span style="font-size: 18px; font-family: trebuchet ms;">112 Vote-Ups</span><br /><br />