Why won't this code work? Well, actually, everything works, except I get no error message when I submit a duplicate URL. I tried moving the check record snippit around, commenting out the exit, but whatever I try still does not work. Where should I put it if I've got it in the wrong place? I have been fussing with this for almost a week, and it has me crazy! I also want to add in something to check the "site name" field for nulls, if you happen to know that snippit off the top of your brain... Thanks in advance!
<?php
if ($REQUEST_METHOD=="POST")
{
# Test for duplicate record
$url="SELECT count(*) FROM links where siteurl = '$siteurl'";
$result = mysql_db_query($db,"$url",$cid);
if (!$url>0)
{
echo ("<P><B>$siteurl is already in the database, <a href=\"http://www.atimealone.com/php/AddLinkTest.php\">try another</a>!</B></P>\n");
# exit;
}
# setup SQL statement
$SQL = " INSERT INTO links ";
$SQL = $SQL . " (category, sitename, siteurl, description) VALUES ";
$SQL = $SQL . " ('$category', '$sitename','$siteurl','$description') ";
#execute SQL statement
$result = mysql_db_query($db,"$SQL",$cid);
# check for error
if (!$result) { echo("ERROR: " . mysql_error() . "\n$SQL\n"); }
echo ("<P><B>New Link Added</B></P>\n");
}
?>