Had to delete my previous topic because of the following:
I have several SQL functions in my controller , to which I call from a table in the view.
However , I want to pass a certain value to those functions from a dropdown I have in the view as well (bypassing the post to model/controller like I thought before)
Now , in the first function I put 18 as an example , but instead of it , I want the number to be from the wid dropdownlist I have at the beginning of my code.
But now I get the following error when I put $wid in my model’s action:
model:
public function countCon($wid)
{
$week=Person_Event::model()->weekByDate();
$week_id=$week->id;
$datalogin=mysqli_connect("192.168.1.137", "volapp", "t2ru3s1Lv","vol_app");
$sql ="SELECT `id` FROM `tbl_event` WHERE `week_id`=$wid";
$query = mysqli_query($datalogin, $sql);
$numrows = mysqli_num_rows($query);
return $numrows;
}
controller:
public function actionWeekset()
{
$model=Event::model(); //did you mean this by loading my model?
$wid = $_POST['wid'];
$conCount = $model->countCon($wid);
echo CJSON::encode(array('conCount'=>$conCount));
return;
}