Jump to content

Why Is This Return Always 1


phprocker
 Share

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
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • 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.