Gayner Posted September 22, 2009 Share Posted September 22, 2009 All the mysql quering being run in a page? Quote Link to comment Share on other sites More sharing options...
Philip Posted September 22, 2009 Share Posted September 22, 2009 Like all the queries you ran, number of queries, or the results from all of them? Quote Link to comment Share on other sites More sharing options...
Gayner Posted September 22, 2009 Author Share Posted September 22, 2009 Like all the queries you ran, number of queries, or the results from all of them? Display just all of them at the bottom That are ran. Quote Link to comment Share on other sites More sharing options...
Alex Posted September 22, 2009 Share Posted September 22, 2009 You could create an additional function, or preferably a class. But if you're looking for simplicity, although I wouldn't necessary suggest it, you could just do something like this: function run_mysql_query($query) { echo "Query: " . $query; mysql_query($query); } run_mysql_query("SELECT * FROM `sometable` WHERE something='value'"); As I previously stated it would be better to create class because you would have much more control and less limitation. Edit: Just read that you want to do it all the bottom, again you should probably use a class.. But if you want to do it the easiest (not the best) way you could do something like: function run_mysql_query($query, &$querylist) { $querylist .= "Query: $query\n"; mysql_query($query); } run_mysql_query("SELECT * FROM `sometable` WHERE something='value'", $querylist); run_mysql_query("SELECT * FROM `sometable` WHERE something='value'", $querylist); run_mysql_query("SELECT * FROM `sometable` WHERE something='value'", $querylist); echo $querylist; Quote Link to comment Share on other sites More sharing options...
ozestretch Posted September 22, 2009 Share Posted September 22, 2009 Are you trying to debug a script by viewing all the actual queries or display the amount of total queries ran on that page? Like the footer of www.phpfreaks.com Page created in 0.026 seconds with 7 queries. Quote Link to comment Share on other sites More sharing options...
Gayner Posted September 22, 2009 Author Share Posted September 22, 2009 Are you trying to debug a script by viewing all the actual queries or display the amount of total queries ran on that page? Like the footer of www.phpfreaks.com Page created in 0.026 seconds with 7 queries. I bought LivinAvatars script for 29.99$, and Im integrating with my IPB !.3.. and i just want to puti a function in index.php to show all the queries so i can get it workin better.. lol Quote Link to comment Share on other sites More sharing options...
Philip Posted September 22, 2009 Share Posted September 22, 2009 I'd use mysqli and extend the class. Setup a new method overloading the query method, and each time you run the query save the query string to an array. Create another that returns the array. Quick example (untested): class MySQLiX extends mysqli { private static $queries = array(); function query($query) { self::$queries[] = $query; return parent::query($query); } function getQueries( ) { return self::$queries; } } // use: $db = new MySQLiX('host','user', 'pass', 'world'); $db->query('SELECT * FROM table WHERE 1'); $db->query("DELETE FROM table WHERE col = 'val'"); print_r($db->getQueries()); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.