mac007 Posted December 17, 2010 Share Posted December 17, 2010 Hello, all... I seem to remember, like if I have a problem with a mysql_query() statement, and want find out why it keeps giving me an error, I'm often told to echo out the statement for debugging purposes. Can somebody remind me again how that's done... thanks! Quote Link to comment https://forums.phpfreaks.com/topic/221948-i-forget-how-do-i-echo-sql-statement-to-see-hows-being-constructed/ Share on other sites More sharing options...
kenrbnsn Posted December 17, 2010 Share Posted December 17, 2010 Let's see your code. Ken Quote Link to comment https://forums.phpfreaks.com/topic/221948-i-forget-how-do-i-echo-sql-statement-to-see-hows-being-constructed/#findComment-1148521 Share on other sites More sharing options...
QuickOldCar Posted December 17, 2010 Share Posted December 17, 2010 do you mean something like this? $result = mysql_query("SELECT * FROM table WHERE value='value'"); if (!$result) { die('Could not connect: ' . mysql_error()); } turn on error reporting in php.ini or do you mean stuff like SHOW, DESCRIBE, EXPLAIN in the query itself Quote Link to comment https://forums.phpfreaks.com/topic/221948-i-forget-how-do-i-echo-sql-statement-to-see-hows-being-constructed/#findComment-1148550 Share on other sites More sharing options...
trq Posted December 17, 2010 Share Posted December 17, 2010 sql statements are simply php strings. $sql = "SELECT * FROM foo"; You can print a string.... echo $sql; Quote Link to comment https://forums.phpfreaks.com/topic/221948-i-forget-how-do-i-echo-sql-statement-to-see-hows-being-constructed/#findComment-1148572 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.