0

I am creating a site where you login with steam and if your steam ID is already in our DB, it adds you, else, nothing happens. Here is my current code:

    $conn = mysql_connect('', '', '');
    mysql_select_db('');
    $result = mysql_query($sql = "SELECT * FROM `users` WHERE steamid=$value LIMIT 1");
    if(mysql_num_rows($result) == 0) {
        global $value;
        mysql_query("INSERT INTO `users`(`steamid`) VALUES ($value)");
    }

This works and adds the ID but it will add it no mater what, even if it is already recorded.. So ever time the user logs in, It creates a new entry in the table, Which mysql_num_rows should be stopping.

How can this be fixed?

nathan
  • 427
  • 1
  • 3
  • 11

0 Answers0