Hello again guys,
I need help with a problem I’ve been having with php and mysql. What I want to do is get the users current ip address and then I want to compare it aginst the table in the db and if there is a match to their current ip I want it to look at the banned column of that row in the db and if the value is ‘true’ then I want to set a var in my php file to true but if it is a value of ‘false’ I want to set the var to false. I have some code below that I got from somewhere else that I’ve been trying to make work but it’s not. Can anybody help me? Thanks! ?
[code=php]<?php
mysql_connect(“mysqlserv”,”mysqluser”,”mysqlpass”);
mysql_select_db(“mysqldbname”);
$ip = $_SERVER[‘REMOTE_ADDR’];
$result = mysql_query(“SELECT * FROM shout WHERE ip = ‘$ip'”);
$r = mysql_fetch_array($result);
$banned = $r[“banned”];
if ($banned = “true”){ $banned = “true”; } else if ($banned = “false”){ $banned = “false”; }
?>