barney0o0 Posted October 27, 2008 Share Posted October 27, 2008 Hi Chaps I have repeat div that i need a conditional display. So, show if the pagecontent.subid doesnt equal 5, but also, dont show if the id doesnt equal 5 and the recordset 'extras' results are empty What ive used so far is <?php do { ?> <?php if ($row_pagecontent['subid'] != '5' || ($row_pagecontent['subid'] != '5' && mysql_num_rows($extras) > 0)): ?> How if the results for extras is empty it is still showing... any ideas?, thanks in advance Link to comment https://forums.phpfreaks.com/topic/130239-conditional-record-display/ Share on other sites More sharing options...
n3ightjay Posted October 27, 2008 Share Posted October 27, 2008 <?php if ($row_pagecontent['subid'] != '5' || ($row_pagecontent['subid'] != '5' && mysql_num_rows($extras) > 0)): ?> the div will always show if the pagecontent.subid != 5 because of the or(||) operator you will always have a logical truth. try this: <?php if ($row_pagecontent['subid'] != '5' && mysql_num_rows($extras) > 0): ?> Link to comment https://forums.phpfreaks.com/topic/130239-conditional-record-display/#findComment-675477 Share on other sites More sharing options...
barney0o0 Posted October 27, 2008 Author Share Posted October 27, 2008 thanks...it works fine.... I just couldnt get my head around the correct logic, even after spending 3 hours on it! many thanks Link to comment https://forums.phpfreaks.com/topic/130239-conditional-record-display/#findComment-675480 Share on other sites More sharing options...
n3ightjay Posted October 27, 2008 Share Posted October 27, 2008 your welcome ... been there many times Link to comment https://forums.phpfreaks.com/topic/130239-conditional-record-display/#findComment-675484 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.