Check codeigniter query errors instead of showing them to the user

前端 未结 3 1030
没有蜡笔的小新
没有蜡笔的小新 2020-12-09 12:04

How can I check if a query went wrong instead of showing errors to users (containing database info which is unsafe).

Let\'s say I have such situation where my paging

3条回答
  •  暖寄归人
    2020-12-09 12:50

    you could check it like:

    function myFunction() {
      echo 'Oeps';
    }
    
    $res = mysql_query($sql);
    if($res && mysql_num_rows($res)>0){
      echo 'Success';
    } else {
       myFunction();
    }  
    

提交回复
热议问题