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

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -