- $logfile=fopen('/tmp/DBlog.log','a+');
- fwrite($logfile,"EXPLAIN $query ;\n");
- fwrite($logfile,"time of above query: $time\n");
+ $logfile=fopen('DBlog.log','a+');
+ fwrite($logfile,"time of query: $time\n");
+ fwrite($logfile,wordwrap(" EXPLAIN $query ;\n", 60, "\n "));
+
+ $result = "";
+ $queryresult = mysql_query("EXPLAIN $query ;");
+ if( $queryresult )
+ while($row = DB_fetch_array($queryresult))
+ $result .= " |".implode("|",$row)."|\n";
+
+ fwrite($logfile,"$result \n\n");