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';

}

}

Edited by cripin
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.