RE: [PHP-DB] problem with mysql_error()
| From: | Bastien Koert | Date: | Thu, 27 Oct 2005 14:52:58 +0000 |
| Subject: | RE: [PHP-DB] problem with mysql_error() | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-40553@lists.php.net to get a copy of this message | ||
<br>Error Message: " . @mysql_error
the '@' symbol suppresses the error message...remove it
bastien
From: Jason Gerfen <jason.gerfen@scl.utah.edu> To: php-db@lists.php.net Subject: [PHP-DB] problem with mysql_error() Date: Thu, 27 Oct 2005 08:43:13 -0600 I am not sure why this is not returning any values but it should be. The database structure CREATE TABLEhosts(idint(11) NOT NULL auto_increment,hostnamevarchar(100) NOT NULL default '',macvarchar(100) NOT NULL default '',ipvarchar(100) NOT NULL default '',vlanvarchar(100) NOT NULL default '', PRIMARY KEY (id), UNIQUE KEYmac(mac), UNIQUE KEYip(ip), UNIQUE KEYhostname(hostname), UNIQUE KEYid(id) ) TYPE=MyISAM AUTO_INCREMENT=4705 ; And the code: $update = @mysql_query( "UPDATE hosts SET hostname=\"$host\", mac=\"$mac\", ip=\"$ip\", vlan=\"$vlan\" WHERE id=\"$id\"", $db )or die( "<img src=\"images/error.jpg\"> <b>Error: </b>Problem occured while updating host records for $host.</b><br>Error Message: " . @mysql_error( $update ) . "<br>" . "Error Number: " . @mysql_errno( $update ) . "<br>Email Administrator: <a href=\"mailto:$defined[mail]\">$defined[mail]</a>" ); Because I have set a couple of the fields to unique I should be recieving an error of 'duplicate entry' but i am getting an empty result for mysql_error(). Any help is appreciated. -- Jason Gerfen Student Computing Labs, University Of Utah jason.gerfen@scl.utah.edu J. Willard Marriott Library 295 S 1500 E, Salt Lake City, UT 84112-0860 801-585-9810 "My girlfriend threated to leave me if I went boarding... I will miss her." ~ DIATRIBE aka FBITKK -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php