petenaylor Posted May 3, 2012 Share Posted May 3, 2012 Hi all I have created a mySQL query and assigned it to a string: $getjobs = mysql_query (" SELECT * FROM jobs WHERE from_date >= '".substr($newdate, 0, 10)."' $keyword_search $sector_search $salary_search $location_search $type_search ORDER BY job_refno DESC ") or die (mysql_error()); Is there any way to output the actual query to the browser to check it? Quote Link to comment https://forums.phpfreaks.com/topic/262019-show-mysql-query/ Share on other sites More sharing options...
Jessica Posted May 3, 2012 Share Posted May 3, 2012 You did not assign the actual query to a string. $sql = "SQL here"; $result = mysql_query($sql) or die("$sql: ".mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/262019-show-mysql-query/#findComment-1342692 Share on other sites More sharing options...
Maq Posted May 3, 2012 Share Posted May 3, 2012 $sql = "SELECT * FROM jobs WHERE from_date >= '".substr($newdate, 0, 10)."' $keyword_search $sector_search $salary_search $location_search $type_search ORDER BY job_refno DESC" echo $sql; $getjobs = mysql_query ($sql) or die (mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/262019-show-mysql-query/#findComment-1342694 Share on other sites More sharing options...
petenaylor Posted May 3, 2012 Author Share Posted May 3, 2012 Great, thanks for your help! Quote Link to comment https://forums.phpfreaks.com/topic/262019-show-mysql-query/#findComment-1342697 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.