any help would be much appreciated.
I have a select/option box passing a $_GET array into a php controller that passes this value into a model retrieving some MySQL.
However I am up to the stage where I am just wishfully stabbing at this now. I think the problem is with the array though.
<select id="frm_type" style="margin-left:180px; width: 136px; height:100%;" name="uid[]" multiple="multiple">
<option value="U4BC3128209B01">All Users</option>
<option value="U4D88B8CFE7579">more options</option>
</select>
The $_GET looks like this ?&uid%5B%5D=U4DFF15A4581A4&uid%5B%5D=U4D88B8CFE7579
This comes into the controller like so…
$filter_in = $_GET;
then is called into the model like this.
$body_data['user_stats'] = $this->mtvm_model->user_stats($filter_in);
Then finally the relevant section that wants to use it does this:
if ($filter_in['uid'] != '')
{
$sqlQuery .= " AND ";
foreach($filter_in['uid'] as $key=>$value)
{
$sqlQuery .= " ".$this->tables_calls.".userId = '".mysql_real_escape_string($value)."' ";
if($key != count($filter_in['uid'])-1)
{
$sqlQuery .= " OR ";
}
}
}
Is it simply that I am incorrectly trying to pass an array as $filter_in['uid']?
The query string:
implies that
$_GET["uid"]looks like this:Your should check for the presence of this variable like this: