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. Quote Link to comment 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 } } ?> Quote Link to comment 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 } ?> Quote Link to comment 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.