I access my database using activeRecords.
I want to make a simple query in one of my action methods in the controller class like this:
$con = ?????
foreach ( $dataProvider->data as $row) {
$sql = "DELETE FROM mytable WHERE Id = ".$row->id;
if (mysqli_query($con,$sql) ) echo $row["Id"]." deleted.<br>";
}
How can I get the current database connection?
Sorry for this beginner question. It’s a long time ago that I used yii …