How to update all re-sortable values of a form in a database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: How to update all re-sortable values of a form in a database

Post by VladSun »

:)
Sindarin wrote:

Code: Select all

//re-sort homepage news
$array_id=$_POST[itemid];
$array_value=$_POST[ordervalue];
You should not use array keys in this form. If you take a look at you error log you will see warning notices about using itemid and ordervalue:
Notice: Use of undefined constant itemid - assumed 'itemid' ....
Also, this "usage style" is vulnerable to variable-value pollution (in fact, it could be considered using global variables) - if you've previously defined

Code: Select all

define('itemid', 'my_value')
you will have a hard to debug error...

So, you should rewrite it in its strict form:

Code: Select all

//re-sort homepage news
$array_id=$_POST['itemid'];
$array_value=$_POST['ordervalue'];
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply