RE: problem with mysql_error()

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

 



<br>Error Message: " . @mysql_error

the '@' symbol suppresses the error message...remove it

bastien


From: Jason Gerfen <jason.gerfen@xxxxxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
Subject:  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 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@xxxxxxxxxxxx

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


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux