Answer the question
In order to leave comments, you need to log in
How to make a selection from a database in Yii1?
Hello. There were problems with data sampling using Yii1, I started working a couple of days ago, I can’t figure out how to do it. If through Mysqli, then the query is:
$con = mysqli_connect("localhost","root","","mydental");
mysqli_set_charset($con,"utf8");
$get=mysqli_query($con, "SELECT * FROM city ORDER BY name ASC");
$option = '';
while($row = mysqli_fetch_assoc($get))
{
$option .= '<option value = "'.$row['name'].'">'.$row['name'].'</option>';
}
Answer the question
In order to leave comments, you need to log in
offtopic: Why not switch to yii2?
to the point:
here is the documentation, I advise you to study:
www.yiiframework.com/doc/guide/1.1/ru/database.ar
www.yiiframework.com/tour
www.yiiframework.com/doc/api
Your example clearly violates MVC. So I think before you do what you want, you need to go over the guides. Will take a couple of hours.
Here are specific requests: www.yiiframework.com/doc/guide/1.1/ru/database.ar#sec-4
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question