transparencia Posted October 25, 2008 Share Posted October 25, 2008 The queries are the following: $query = "SELECT *, u.name as uploader_name FROM #__attachments AS aa "; $query .= "INNER JOIN #__users AS u ON u.id = aa.uploader_id "; $query .= "WHERE aa.article_id='$article_id' AND aa.published='1' "; $query .= "ORDER BY $order_by"; The queries above are suposed to do the same thing as this: $query = "SELECT * FROM #__attachments WHERE article_id='$article_id' AND published='1' ORDER BY $order_by"; But adding a new feature. Is there any syntax or other problem with the above queries? Quote Link to comment https://forums.phpfreaks.com/topic/130117-solved-any-syntax-problem-with-these-queries/ Share on other sites More sharing options...
Barand Posted October 26, 2008 Share Posted October 26, 2008 mysql_query($query) or die(mysql_error()); will tell you if there is an error Quote Link to comment https://forums.phpfreaks.com/topic/130117-solved-any-syntax-problem-with-these-queries/#findComment-674771 Share on other sites More sharing options...
shlumph Posted October 26, 2008 Share Posted October 26, 2008 I'd suggest: $query = "SELECT aa.*, u.name AS uploader_name FROM #__attachments AS aa INNER JOIN #__users AS u ON u.id = aa.uploader_id WHERE aa.article_id='$article_id' AND aa.published='1' ORDER BY $order_by"; Quote Link to comment https://forums.phpfreaks.com/topic/130117-solved-any-syntax-problem-with-these-queries/#findComment-674776 Share on other sites More sharing options...
transparencia Posted October 26, 2008 Author Share Posted October 26, 2008 Great! Thanks shlumph, it worked! Barand: There was an error, it wasn't doing what it was supposed to do. But now it works just fine. Quote Link to comment https://forums.phpfreaks.com/topic/130117-solved-any-syntax-problem-with-these-queries/#findComment-674796 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.