Simple vote up/down? |
[eluser]Unknown[/eluser]
I've been trying for hours... How would I go about creating two buttons/images which are labeled "up" and "down"? Upon clicking one of them, they will launch a SQL query that will add +1 to the current row? For example: Current up: 8 Current down: 3 *User clicks up button/image* *mySQL does it magic* Current up: 9 Current down: 3
[eluser]ywftdg[/eluser]
I would say the typical, basic php method, would be to pass a number (or value) through the url, then use the URI helper to get those values and run your query. You could also use a more modern approach, if you need/want it, and use ajax.
[eluser]Unknown[/eluser]
[quote author="ywftdg" date="1218441891"]I would say the typical, basic php method, would be to pass a number (or value) through the url, then use the URI helper to get those values and run your query. You could also use a more modern approach, if you need/want it, and use ajax.[/quote]Yea, I wanted to do ajax. Would it be possible to help me out on this? If ajax is too much, we can go for the non-ajax version.
[eluser]Sumon[/eluser]
Very easy with AJAX also. Use former solution by ajax. Lets say your url is: www.mysite.com/counts/3 (You have tested this works fine when you hit this url directly) For example consider this is your AJAX function. Code: [removed] Simply call the function from your buttons/images which are labeled “up” and “down” Code: DisplayOutput('divwhereyourCurrentup8show') |
Welcome Guest, Not a member yet? Register Sign In |