[PHP-DB] problem with mysql_error()

2005-10-27 Thread Jason Gerfen

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;bError: /bProblem occured 
while updating host records for $host./bbrError Message:  . 
@mysql_error( $update ) . br . Error Number:  . @mysql_errno( 
$update ) . brEmail 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
[EMAIL PROTECTED]

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



RE: [PHP-DB] problem with mysql_error()

2005-10-27 Thread Bastien Koert

brError Message:  . @mysql_error

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

bastien



From: Jason Gerfen [EMAIL PROTECTED]
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 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;bError: /bProblem occured while 
updating host records for $host./bbrError Message:  . @mysql_error( 
$update ) . br . Error Number:  . @mysql_errno( $update ) . 
brEmail 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
[EMAIL PROTECTED]

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