problem with mysql_error()

From: Date: Thu, 27 Oct 2005 14:43:13 +0000
Subject: problem with mysql_error()
Groups: php.db 
Request: Send a blank email to php-db+get-40552@lists.php.net to get a copy of this message
I am not sure why this is not returning any values but it should be. The database structure CREATE TABLE hosts ( id int(11) NOT NULL auto_increment, hostname varchar(100) NOT NULL default '', mac varchar(100) NOT NULL default '', ip varchar(100) NOT NULL default '', vlan varchar(100) NOT NULL default '', PRIMARY KEY (id), UNIQUE KEY mac (mac), UNIQUE KEY ip (ip), UNIQUE KEY hostname (hostname), UNIQUE KEY id (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\">&nbsp;&nbsp;<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

« previous php.db (#40552) next »