Hello everybody. I'm newbie in PHP. I am running PHP version 5.1.2 together with Apache version 2.0.52 and mySQL version 4.1 on a Windows XP system. Consider these functions: [color=green]function BOX_exists( $BOX_id ) { $sql = "SELECT IDBOX FROM box ". "WHERE IDBOX='".$BOX_id."';"; $this->query($sql); return ($this->num_rows() == 1); } function insert_BOX( $BOX_id, $Description) { if (!$this->BOX_exists( $BOX_id )) { $sql = "INSERT INTO box (IDBOX, Description )". "VALUES ('$BOX_id', '$Description');"; $this->query( $sql ); return true; } else { return false; } }[/color] The problem I have is that calling to insert_BOX function, always inserts correctly data on mySQL, but the return value from insert_BOX is sometimes false (not always, sometimes is true). As can be seen, this should be impossible, since data is correctly inserted. I only call insert_BOX once, but what would happen in case insert_BOX is executed twice for some reason? The second call would return false. I feel this is the problem I'm having. I don't know how to handle this problem. I spent many hours without success. I will appreciate any idea or help. Thanks in advance.