jaikar Posted March 27, 2008 Share Posted March 27, 2008 hi there. in the below case, does it executes the query once / twice ?, does this reduce the performance when used to execute the queries? function db_query($query) { if(!mysql_query($query)) { die(redirect_page().'<br>'.$query.'<br>'.mysql_error()); } else { return mysql_query($query); } } Thanks !... Link to comment https://forums.phpfreaks.com/topic/98119-does-this-reduce-performance/ Share on other sites More sharing options...
ansarka Posted March 27, 2008 Share Posted March 27, 2008 function db_query($query) { $res=mysql_query($query); $num_rows=mysql_numrows($res); if(!$num_rows) { die(redirect_page().' '.$query.' '.mysql_error()); } else { return $res; } } Link to comment https://forums.phpfreaks.com/topic/98119-does-this-reduce-performance/#findComment-501957 Share on other sites More sharing options...
jaikar Posted March 27, 2008 Author Share Posted March 27, 2008 hi thanks !.. i modified the previous code a bit and it works !.. function db_query($query) { if(mysql_query($query)) { return mysql_query($query); } else { die(redirect_page().'<br>'.$query.'<br>'.mysql_error()); } } Link to comment https://forums.phpfreaks.com/topic/98119-does-this-reduce-performance/#findComment-501958 Share on other sites More sharing options...
jaikar Posted March 27, 2008 Author Share Posted March 27, 2008 oops !.. yours is correct !.. mine again executes twice .. Link to comment https://forums.phpfreaks.com/topic/98119-does-this-reduce-performance/#findComment-501959 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.