Question about column item in Ajax voting script

Place for comments, problems, questions, or any issue related to the JavaScript / PHP scripts from this site.
Nike555
Posts: 12

Question about column item in Ajax voting script

Hi
I have 1 little question about your Ajax voting script ( https://coursesweb.net/php-mysql/voting- ... pt-ajax_s2 )
I use only "vot_plus", you are maked in table `votusers` the column `item` (varchar 200) where is put item in this form:
vt_<number/id>
This form of put id is for some protection?
Why you are not used simple number/id column int?
If i will change to simple number/id is not nothing bad in protection?

Thanks

Admin Posts: 805
Hi
The value for "item" is not necessary to be an integer number, it can be a number or a string.
In the html code you can have:

Code: Select all

<div class="vot_plus" id="vt_1"></div>
And:

Code: Select all

<div class="vot_plus" id="vt_string"></div>
So, the value registered in "item" will be: 1 and 'string'.
In the php code in "class.voting.php" the values for 'item' are inserted as string (between simple quotes); so, it is better to not change the column type.

I did not use simple number/id because I wanted to can set more freely the id in html.