Jump to content

[SOLVED] Query issues;


czukoman20

Recommended Posts

Hello, i'm a noob that needs help with a little bit of coding

 

I have 2 pictures of my mysql database that are setup.

 

The highlighted area in the pictures shows you what i would like to concentrate on.

http://www.czartgaming.com/testpages/help/phpMyadmin.jpg

http://www.czartgaming.com/testpages/help/phpMyadmin2.jpg

What i would like to do is have it so the user can click on a button, then that will update that num_clicks info to +1. so everytime the user clicks that button... it will update with 1 added to that database. i need help with using the query function i believe, and to make it so i can do this.

 

so if i'm confusing people with my wording.

num_clicks = 1

 

when the user clicks the button ... num_clicks = 2 

when the user clicks it again ... num_clicks = 3

 

Help is greatly appreciated  :)

 

 

Link to comment
Share on other sites

ok well i tried what you said to do after that, but it doesnt work at all now. i can get it to work for all of that row, but not just for that one user.

 

I tried the username variable that i set earlier, and i know that works, because its saying the username on the page that i'm using for it, and i even tried typing in the username manually. still didnt work.

 

so if you have any other options, that would be great

mysql_select_db('czartga_login')
or die('Error, cannot select mysql database');
$query="update users set num_clicks=(num_clicks+1) WHERE userid=$username";
$result=mysql_query($query);

 

that is what i used

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.