|
Posted by ZeldorBlat on 06/28/07 20:10
On Jun 28, 2:41 pm, tritone <mike...@gmail.com> wrote:
> $sql = "DELETE FROM " . $mosConfig_dbprefix . "foo WHERE foo_id = '" .
> mosGetParam($_POST, 'cid', '' )[$a] . "'";
>
> was throwing errors and I fixed it be doing this:
>
> $cidx = mosGetParam( $_POST, 'cid', '' );
> $sql = "DELETE FROM " . $mosConfig_dbprefix . "foo WHERE foo_id = '" .
> $cidx[$a] . "'";
>
> My question is why didn't the first version work and is there a way to
> code it without adding the intermediate variable?
It doesn't work because that syntax is not supported by PHP.
You could make it work by creating another function (mosGetParamNum or
something) that "wraps" you current mosGetParam and takes the index as
an additional parameter.
[Back to original message]
|