0

I want the code to limit what it echos to only echo results that state "online" when it sends to unity however still shows all the results

if(mysqli_num_rows($result) > 0){
    //show data for each row
    while($row = mysqli_fetch_assoc($result)){
        if($row['online'] = "online")
        {
            echo "ip:".$row['ip'] . "|name:".$row['name']. "|usercount:".$row['usercount'] . ";";
        }
    }
}
Darkal
  • 1
  • 3
  • Possible duplicate of [The 3 different equals](https://stackoverflow.com/questions/2063480/the-3-different-equals) –  Nov 05 '17 at 22:11

1 Answers1

2

You just have one very simple mistake. Change this line:

if($row['online'] = "online")

to:

if($row['online'] == 'online')
fubar
  • 16,918
  • 4
  • 37
  • 43
  • YAY!!! it worked thats lot easier then trying have unity limit it down thankyou still newbe – Darkal Nov 05 '17 at 22:24
  • @Darkal - another improvement would be to include this condition within your SQL query, so save having to filter the results afterwards. – fubar Nov 05 '17 at 22:32