need help with logical operator on my class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



question is below this script:

------begin-------
<?php
class database
{
  var $query_result;
  var $data;
  var $connection;
  
  function database()
  {
        $this->connection = mssql_connect("SERVER", "sa", "");
        mssql_select_db("dbname", $this->connection);
        
        return $this->connection;
  }
  
  function error_message($message="")
  {
        die("$message<br>" . mssql_get_last_message());
  }
  
  function insert($tables, $fields, $values)
  {
        $sql = "INSERT INTO $tables ($fields) VALUES $values";
        
        @mssql_query($sql, $this->connection) or $this->error_message($sql);
  }
}
?>
------end-------

why every time i execute $this->insert('table', 'field', 'value'),
$this->error_message() is always executed? while the query is succeded,
i check from MS-SQL Enterprise Manager the data i'm inserted is in there.

does my script wrong?

i also try change

@mssql_query($sql, $this->connection) or $this->error_message($sql);

to:

if (!mssql_query($sql, $this->connection))
{
  $this->error_message($sql);
}

but $this->error_message($sql) is still executed.

thanks

Markus



PHP Data object relational mapping generator - http://www.meta-language.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux