Jump to content

How do I Show all the queries im running?


MouseMuffin

Recommended Posts

And echo them so I can debug and see what im running?

 

Echo $sql? Or you can write them to disk even (appending to a log)

$sql = "SELECT * WHERE TABLE = ..";
mysql_query($sql);

$fp = fopen("sql_log.html",  "a");  
fputs($fp, "<b>Time:</b> " . date("F jS Y, h:iA") . "<br/>\n");
fputs($fp, "$sql <br/>\n");
fclose($fp);  

 

Or use a query to get mysql_affected_rows

 

NO i mean like a Debugging script

 

What on earth do you mean? You won't get help like this. Debugging is impossible unless you use exec such as running the linux command --slow_query_log_file=file_name[...], makes no sense unless you give us an example of what you want to do.

Link to comment
Share on other sites

YOu know what I want to do? make wash your mouth out with soap u non helping bastard!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

 

All I asked was to show all the queries that are run at the bottom of my page so I can figure out what I am doing, I guess your not too bright arn't ya fella.

Link to comment
Share on other sites

YOu know what I want to do? make wash your mouth out with soap u non helping bastard!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

If you were intelligent enough to base ideas off the advice given, and press a link that I provided (assuming you are), than you would have found your answer.

 

If you have problematic code, show us, and ask for a solution, that is all you'll get, not the magic answer you expected.

All I asked was to show all the queries that are run at the bottom of my page

 

If you would have actually asked that, you would have gotten a better idea of what to do, funny how it works eh?

Link to comment
Share on other sites

There is no debugger built into php itself. oni-kun has posted what would be considered a (simple yet) valid solution. You need to save your queries into a variable, then either write them to a file or echo them to the screen.

 

An easier method would be to make a function that you can use to actually log, and at the same time return your queries. Something like....

 

function query($sql) {
  file_put_contents(date() . ' : ' $sql, '/path/to/logfile/sql.log', FILE_APPEND);
  return $sql;
}

 

You could then use this within your queries like so....

 

mysql_query(query("SELECT * FROM foo"));

 

Ps: Please don't so uptight with our members, everyone is here to help.

Link to comment
Share on other sites

There is no debugger built into php itself. oni-kun has posted what would be considered a (simple yet) valid solution. You need to save your queries into a variable, then either write them to a file or echo them to the screen.

 

An easier method would be to make a function that you can use to actually log, and at the same time return your queries. Something like....

 

function query($sql) {
  file_put_contents(date() . ' : ' $sql, '/path/to/logfile/sql.log', FILE_APPEND);
  return $sql;
}

 

You could then use this within your queries like so....

 

mysql_query(query("SELECT * FROM foo"));

 

Ps: Please don't so uptight with our members, everyone is here to help.

 

Lol how retarded can u get?

 

This method will not work,

 

This will just save each query And then when I try to read there going to be all bunched in there, I only need to show each querie once not store them, Lol how retarded can you guys geT? Go learn some C+

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.