Welcome Guest, Not a member yet? Register   Sign In
which rule is better for id ?
#1

[eluser]Unknown[/eluser]
mysql table:

1. users:
id_user
id_group
...

2. users_group
id_group
group_name
..



i wanna check that id_group is ID, which rule should i use for security better.
i have used 'is_natural' rule before, but i see others using native 'intval' orr 'ctype_digit' to check that it is intger.


i will also using callback to check it before confirm 'id_group ' is correct input.


thx for help , and sry my poor english

#2

[eluser]InsiteFX[/eluser]
For a users ID it should be an integer, all ID's should be named ( id ) and not ( id_xxxx ).

The reason for this is that some database drivers will only work on an id key.
#3

[eluser]Unknown[/eluser]
THANKS for reply.
i see some field using 'xxx_id' instead of 'ID' , but some field using 'ID' .
how can i know using which name in different type table content that will be better. thanks

wordpress:
wp_links ,wp_usermeta , wp_options using xxx_id

wp_post and wp_user using 'ID'
#4

[eluser]InsiteFX[/eluser]
If you have to access an id then use id, if it's a pivot table then you can use whatever you want.




Theme © iAndrew 2016 - Forum software by © MyBB