Jump to content

Why Is This Return Always 1


phprocker

Recommended Posts

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);
?>

Link to comment
https://forums.phpfreaks.com/topic/217164-why-is-this-return-always-1/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.