Phpfr3ak Posted October 23, 2010 Share Posted October 23, 2010 Probably real basic but i cant get to grips with it for the life of me, can anyone correct this and explain how its done please so i gain a better understanding of php thanks. <?php if(SELECT mode FROM settings WHERE mode = 1){ ?> Quote Link to comment https://forums.phpfreaks.com/topic/216627-any-chance-of-some-help-please/ Share on other sites More sharing options...
kenrbnsn Posted October 23, 2010 Share Posted October 23, 2010 What are you trying to accomplish. That statement is mixing MySQL & PHP, which is not allowed like that. Ken Quote Link to comment https://forums.phpfreaks.com/topic/216627-any-chance-of-some-help-please/#findComment-1125510 Share on other sites More sharing options...
trq Posted October 23, 2010 Share Posted October 23, 2010 Correct it? Its not at all valid php, you need explain what it is your trying to do. Execute a query? See mysql_query. Quote Link to comment https://forums.phpfreaks.com/topic/216627-any-chance-of-some-help-please/#findComment-1125512 Share on other sites More sharing options...
Phpfr3ak Posted October 23, 2010 Author Share Posted October 23, 2010 <?php if($mode == 1){ ?> is what i tried but i have no clue as to how to establish $mode as being settings>mode in the sql database, really rather new to it all. Quote Link to comment https://forums.phpfreaks.com/topic/216627-any-chance-of-some-help-please/#findComment-1125514 Share on other sites More sharing options...
trq Posted October 23, 2010 Share Posted October 23, 2010 Your still not being at all clear. Quote Link to comment https://forums.phpfreaks.com/topic/216627-any-chance-of-some-help-please/#findComment-1125515 Share on other sites More sharing options...
Phpfr3ak Posted October 23, 2010 Author Share Posted October 23, 2010 how would i define the variable to show $mode being under settings>mode in the database, sorry for my lack of clarity before, hope this explains it better.. Quote Link to comment https://forums.phpfreaks.com/topic/216627-any-chance-of-some-help-please/#findComment-1125518 Share on other sites More sharing options...
trq Posted October 23, 2010 Share Posted October 23, 2010 I gave you a link to the manual which describes how to execute a query. Did you look at it? Quote Link to comment https://forums.phpfreaks.com/topic/216627-any-chance-of-some-help-please/#findComment-1125524 Share on other sites More sharing options...
Phpfr3ak Posted October 23, 2010 Author Share Posted October 23, 2010 Yea... i tried ... no luck :/ $mode = mysql_query('SELECT mode FROM settings'); <?php if($mode == 1){ ?> <?php } else {?> <br /><br /> <p><span style="margin-left:8px"> <?php include("endgame.php"); }?></td> Quote Link to comment https://forums.phpfreaks.com/topic/216627-any-chance-of-some-help-please/#findComment-1125583 Share on other sites More sharing options...
trq Posted October 23, 2010 Share Posted October 23, 2010 <?php if ($result = mysql_query('SELECT mode FROM settings LIMIT 1')) { if (mysql_num_rows($result)) { $row = mysql_ftech_assoc($result); if ($row['mode'] != 1) { echo "<br /><br />"; echo "<p><span style=\"margin-left:8px\">"; include "endgame.php"; echo "</td>"; } } } Quote Link to comment https://forums.phpfreaks.com/topic/216627-any-chance-of-some-help-please/#findComment-1125742 Share on other sites More sharing options...
Phpfr3ak Posted October 24, 2010 Author Share Posted October 24, 2010 Thank you very much thorpe, made that very clear i now have an understanding, many thanks! Quote Link to comment https://forums.phpfreaks.com/topic/216627-any-chance-of-some-help-please/#findComment-1125758 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.