Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Criteria Dosent Work In Php But Works In Phpmyadmin

$
0
0
Hi everyone

I have a simple criteria with a single JOIN, when i execute it in php, i got results only from ProjectModel, but when i execute in phpMyAdmin i got result from project_rating table too.
In phpMyAdmin i run this query

SELECT `pr`.*,`p`.* FROM `project` `p` JOIN project_rating AS `pr` ON( `p`.P_Id = `pr`.Project_id ) WHERE 1=1 ORDER BY `p`.P_Add_date DESC



In Php i run this criteria, no results from project_rating table
$projectList                    = new ProjectModel();
 
$criteria                       = new CDbCriteria();
$criteria->alias                = "p";
$criteria->select               = "`pr`.*,`p`.*";
$criteria->join                 = "JOIN project_rating AS `pr` ON( `p`.P_Id  = `pr`.Project_id )";
$criteria->order                = "`p`.P_Add_date DESC";
 
$this->data["projectList"]     = $projectList->findAll( array(),$criteria );
 
$this->layout = "main";
$this->render('projectList');


I am sorry for my English

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>