phprocker Posted October 29, 2010 Share Posted October 29, 2010 Hey all. My site has a config database table that has a column showlogin to set whether or not login functionality is enabled. I'm playing around with MySQLi, Classes, and Returns. My return is always 1. Where am I going wrong? test.php <?php // Start Session session_start(); // Production Settings ini_set('display_errors', 1); mysqli_report(MYSQLI_REPORT_ALL); include 'db.php'; $mysqli = new mysqli($host, $user, $pass, $db); class styles { function showlogin($show) { global $mysqli; $select = $mysqli->query("SELECT showlogin FROM config LIMIT 1"); $value = $select->fetch_object(); if ($value->showlogin = 1) { return 1; } return 0; } } $login = new styles(); echo $login->showlogin($show); ?> Quote Link to comment Share on other sites More sharing options...
btherl Posted October 29, 2010 Share Posted October 29, 2010 if ($value->showlogin = 1) { should be if ($value->showlogin == 1) { Even experienced programmers get that wrong every now and then Some programming languages will give you a warning if they see that kind of mistake. Quote Link to comment Share on other sites More sharing options...
phprocker Posted October 29, 2010 Author Share Posted October 29, 2010 Cheers mate! 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.