I want to prevent duplicate entries in by database in the hostname
field.
So far, I have modified my hostname column as such to prevent duplicate
entries into it, it works:
alter table <table> modify <column> varchar(15) null unique;
Now I need to notify the user that enters a duplicate hostname of their
error, the database prevents the entry, but the user dosn't know it.
Here's my PHP script, any thought how best to modify it?
THX!
Pete
<html>
<body>
<?php
require("fedb.inc");
mysql_connect(localhost,$user,$password);
@mysql_select_db($db) or die( "Unable to select database");
/*Insert into database */
mysql_query ("INSERT INTO asset (site_id, hostname, device, model,
serial, ip,
dept, mhz, ram, hd_size, os_ver, status, data_port,
pp_port, hub_port,
digi_port, csmim_port, tprmim_port, xyplex_port,
comments, fe)
VALUES ('$site_id', '$hostname', '$device',
'$model', '$serial', '$ip',
'$dept', '$mhz', '$ram', '$hd_size',
'$os_ver', '$status',
'$data_port', '$pp_port', '$hub_port',
'$digi_port',
'$csmim_port', '$tprmim_port',
'$xyplex_port',
'$comments', '$fe')
");
print ($site_id);
print (" ");
print ($hostname);
print (" ");
print ($device);
print (" ");
print ($model);
print (" ");
print ($serial);
print (" ");
print ($ip);
print (" ");
print ($dept);
print (" ");
print ($mhz);
print (" ");
print ($ram);
print (" ");
print ($hd_size);
print (" ");
print ($os_ver);
print (" ");
print ($status);
print (" ");
print ($data_port);
print (" ");
print ($pp_port);
print (" ");
print ($hub_port);
print (" ");
print ($digi_port);
print (" ");
print ($csmim_port);
print (" ");
print ($tprmim_port);
print (" ");
print ($xyplex_port);
print (" ");
print ($comments);
print (" ");
print ($fe);
print (" ");
print ("<p>");
print ("<p>");
print ("Thanks for submitting your device.");
print ("<p>");
print ("Please do not reload this page, it will produce a duplicate
record");
?>
<a href='index.html'><b>Home</b></a>
</body>
</html>
--
_______________________________________
Pete Kuczynski
Principal Field Engineer
DHL Airways Inc.
Infrastructure Technology & Services
(773)-462-9758
24/7 Helpdesk 1-800-434-5767
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]