Don wrote:
> 
> Hi,
> 
> I'm using Perl to maintain a database.  I'd like to search for a record
> in a database and if it does not exist, add it.  Otherwise, just update
> the fields.  In my script, I have:
> 
>  $sqlCmd = $dbh->prepare("SELECT PortName FROM Ports where PortName =
> '$port' ");
>  $sqlCmd->execute();

$rc = $sqlCmd->execute().
$rc is the return code.
> 
> Where '$port' is a scaler variable.
> If the record exists, I suppose I can do an INSERT. If not, I'll do an
> UPDATE.  I can't seem to find the code/function to check for this simple
> test.
> 
> Thanks,
> Don
>

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to