php - Yii how to check if query execution failed -
i m using yii develop web application
i want check if query executed or not
$data = yii::app()->db->createcommand($sql); $result = $data->queryall(); if(count($result) == 0) { throw new soapfault('sender', 'unable display information.'); } if code execute if select query return no result-set. want check if query executed or not. based on want throw exception. if query executed , returned no result-set other exception.
how ? suggestions ?
try { $result = $data->queryall(); } catch (exception $ex) { echo 'query failed', $ex->getmessage(); }
Comments
Post a Comment