I am trying to integrate a grid into a Yii based PHP application.
The javascript code I use to create the grid is:
and the Yii PHP code server-side is:
public function actionGrid_data()
{
$res=mysql_connect("localhost","root","root");
mysql_select_db("448695_foundation");
$grid = new GridConnector($res, "MySQL");
$config = new GridConfiguration();
$config->setHeader("Username,First Name,Last Name,Email");
$config->setInitWidths('150,150,150,*');
$config->setColTypes("ro,ro,ro,ro");
$grid->set_config($config);
$sql = "SELECT username, firstname, lastname, email
FROM User
INNER JOIN AuthAssignment ON userid = id;
$grid->render_sql($sql,"id","username,firstname,lastname,email");
}
It works fine, but now I need to add a WHERE clause to the SQL statement to filter out the non-relevant records. The SQL statement should become:
“SELECT username, firstname, lastname, email
FROM User
INNER JOIN AuthAssignment ON userid = id
WHERE itemname = '” . $itemname . " '";
I cannot figure out how to pass the $itemname parameter to the actionGrid_data function.
Can anyone please help, thanks.