At 03:48 24/02/03, you wrote:
Hi, please see the following red code...
(i get plain text, so not red)

it adds info to a MySQL Table called "Schools". Whats the problem? Although the first time you execute it, it works, after the first time you send the form you get ERROR.

    $qs = 'INSERT INTO Schools (LongName, Abbreviation) VALUES (' .
      "'" . addslashes(trim($longname)) . "'," .
      "'" . addslashes(trim($abbrev)) . "')";

    if(!mysql_query($qs, $db))
      echo '<font color="red"><b>Error</b></font><br />';

-------------------
KEY Approved (Approved),
KEY ShortName (ShortName),
UNIQUE ShortName_2 (ShortName)
It seems that the problem resides in ShortName.... but I still donīt understand what to do...
i guess that ShortName_2 is the problem, since it needs to be unique and the first time you enter the form it enters a data set or row with Shortname_2 empty, and the second time you try it is still empty.

When developing a script, try
echo '<font color="red"><b>Error: '.mysql_error().'</b></font><br />';
to see mysql's reactions.
or
$result=mysql_query($qs,$db)
or die ('<br><font color=red>Error in '.__FILE__.' line '.__LINE__.'<br>Query was:'.$qs.'<br>Mysql error:'.mysql_error()):



PS please choose a better title than 'Me again...'



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



Reply via email to