maxudaskin Posted December 4, 2007 Share Posted December 4, 2007 I have a little bit of a script that is not functioning properly. Is there anything wrong? <?php $constructionsql = mysql_query("SELECT value FROM config WHERE name='construction'"); while($constructionresult = mysql_fetch_array($constructionsql)){ $construction = $constructionresult['value']; } echo 'Construction = '.$construction; if($construction=1){ echo '<table width="98%" border="0" cellpadding="0">'; echo '<tr>'; echo '<td><div class="status_box">'; echo '<h1 style="text-align: center;" class="status_message status_note">This website is currently under construction.</h1>'; echo '</div></td>'; echo '</tr>'; echo '</table>'; }else{}} ?> When I call construction() it will always echo the table and contents. Right now, construction = 0. Link to comment https://forums.phpfreaks.com/topic/80067-solved-ifelse/ Share on other sites More sharing options...
Crew-Portal Posted December 4, 2007 Share Posted December 4, 2007 Try: <?php $constructionsql = mysql_query("SELECT value FROM config WHERE name='construction'"); while($constructionresult = mysql_fetch_array($constructionsql)){ $construction = $constructionresult['construction']; echo 'Construction = '.$construction; if($construction == 1){ echo '<table width="98%" border="0" cellpadding="0">'; echo '<tr>'; echo '<td><div class="status_box">'; echo '<h1 style="text-align: center;" class="status_message status_note">This website is currently under construction.</h1>'; echo '</div></td>'; echo '</tr>'; echo '</table>'; } else{ // Blablabal } } ?> Link to comment https://forums.phpfreaks.com/topic/80067-solved-ifelse/#findComment-405758 Share on other sites More sharing options...
phpQuestioner Posted December 4, 2007 Share Posted December 4, 2007 <?php $constructionsql = mysql_query("SELECT value FROM config WHERE name='construction'"); while($constructionresult = mysql_fetch_array($constructionsql)){ $construction = $constructionresult['value']; } echo 'Construction = $construction'; if($construction == "1") { echo '<table width="98%" border="0" cellpadding="0">'; echo '<tr>'; echo '<td><div class="status_box">'; echo '<h1 style="text-align: center;" class="status_message status_note">This website is currently under construction.</h1>'; echo '</div></td>'; echo '</tr>'; echo '</table>'; } else { // display content or do something here } ?> Link to comment https://forums.phpfreaks.com/topic/80067-solved-ifelse/#findComment-405760 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.