jamesxg1 Posted December 9, 2010 Share Posted December 9, 2010 Hiya peeps! I have this code; $q3 = "SELECT `data` FROM `firm_text_strings` WHERE `id` = '100' AND `languages_id` = 'EN'"; $q4 = "SELECT `data_2` FROM `firm_text_strings` WHERE `id` = '100' AND `languages_id` = 'EN'"; $r3 = mysql_query($q3); $r4 = mysql_query($q4); if($r3 && $r4) { while($w3 = mysql_fetch_assoc($r3) && $w4 = mysql_fetch_assoc($r4)) { $resultStr = $w3['data'] . '<br />' . $w4['data_2']; } } else { $resultStr = 'error'; } everything is working up to the while function, it just wont do the loop for some reason. Anyone have any ideas. Many thanks, James. Quote Link to comment https://forums.phpfreaks.com/topic/221166-mysql-query-not-working-its-the-while/ Share on other sites More sharing options...
trq Posted December 9, 2010 Share Posted December 9, 2010 Why are you executing two queries on the same table in the first place? Quote Link to comment https://forums.phpfreaks.com/topic/221166-mysql-query-not-working-its-the-while/#findComment-1145148 Share on other sites More sharing options...
jamesxg1 Posted December 9, 2010 Author Share Posted December 9, 2010 Why are you executing two queries on the same table in the first place? Hmmm.... I didn't think of that. Let me change the code over, this is embarrassing...... lol. Many thanks, James. Quote Link to comment https://forums.phpfreaks.com/topic/221166-mysql-query-not-working-its-the-while/#findComment-1145149 Share on other sites More sharing options...
jamesxg1 Posted December 9, 2010 Author Share Posted December 9, 2010 $q1 = "SELECT `data`, `data_2` FROM `firm_text_strings` WHERE `id` = '100' AND `languages_id` = 'EN'"; $r1 = mysql_query($q1); if($r1) { while($w1 = mysql_fetch_assoc($r1)) { $resultStr = $w1['data'] . '<br />' . $w1['data_2']; } } else { $resultStr = 'error'; } Changed, still nothing =/ Many thanks, James. Quote Link to comment https://forums.phpfreaks.com/topic/221166-mysql-query-not-working-its-the-while/#findComment-1145151 Share on other sites More sharing options...
jcbones Posted December 9, 2010 Share Posted December 9, 2010 You mean that you get a blank screen, or you get 'error'? Quote Link to comment https://forums.phpfreaks.com/topic/221166-mysql-query-not-working-its-the-while/#findComment-1145154 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.