Jump to content

Need some help with figuring out a query please


cripin

Recommended Posts

Hello, i added a vote button to my site (on local host still developing) it now appears on all rows basically as soon as the row gets created it appears, but the voting button only lets you vote for 1website, you can click any of them it takes you to the same page and when u enter and press vote the votes only add to one site, how can i make it so that the vote would add up to a specific site. I am guessing it should depend on an id but cant figure out how the query and code should look for this. As you can see it only votes for 1 because the id is set 1, how should i change it so that each topsite would have vote button with specific id?

 

if(isset($_POST['code']))

{

$vote_code = $_POST['code'];

 

if(!empty($vote_code))

{

$query = "SELECT count FROM users WHERE id=1";

 

if ($query_run = mysqli_query($con, $query))

{

 

list($k) = mysqli_fetch_row($query_run);

 

$jr = $k + 2;

  $voteup = "UPDATE users SET count ='$jr' WHERE id =1";

  $updatevote = mysqli_query($con, $voteup);

  

  echo 'your vote has been added" "';

   }

}else{

echo 'hi';

}

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.