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
https://forums.phpfreaks.com/topic/65465-solved-query-issues/
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
https://forums.phpfreaks.com/topic/65465-solved-query-issues/#findComment-327096
Share on other sites

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.