0

here my username is know as callsign

there is a problem somewhere that i cant find

and i present the code:

        $callsign = mysql_real_escape_string($_POST["CallSign"]);

        $result = mysql_query("SELECT * FROM users WHERE CallSign = '$callsign'");

        $row = mysql_fetch_array($result);

        echo $row['CallSign'] . "<br>";

        $sql = "SELECT COUNT(*) FROM users WHERE CallSign = '$callsign'";
        $result = mysql_query($sql) or die('error');

        if($result > 0)
        {
            echo "That CallSign has been claimed Already!<br>";
            echo "<p><a href='register.php'>Return to Try Again</a><br>";
        }
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by phorce
1

mhmh, just a suggestion.. But I don't code like you:

<?php

   $callsign = mysql_real_escape_string($_POST['CallSign']);
   $query = "SELECT * FROM users WHERE Callsign='$callsign'";
   $result = mysql_query($query);
   if(mysql_affected_rows() == 1)
   {
        $row = mysql_fetch_row($result);
        echo $row[0] . "<br>";

   }else{
     echo "That CallSign has been claimed Already!<br>";
     echo "<p><a href='register.php'>Return to Try Again</a><br>";

   }


?>

I don't see what the problem is? Maybe it's something to do with your database table, how the field name is or something!

Edited by phorce

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.