On Mon, 22 Jan 2001, Don wrote:

> Hi,
> 
> I'm looking at the docs for the UPDATE syntax right now!
> 
> Here is my code (in Perl):
> 
> $sqlCmd = $dbh->prepare("UPDATE Ports SET Country   = $country,
>                                           TransPort = $transPort,
>                                           Suspended = $suspended,
>                                           Transit   = $transit,
>                                           Tranship  = $tranship,
>                                           CargoDisp = $disposition
>                          WHERE PortName = $port");

You need to use single quotes around your variables.


> Ports is my table.  "GERMANY" is actually the contents of the scaler
> array $country, so why is it giving me an unknown column error?


$country being an array explains your problem. if $country sends the value
"USA GERMANY", mysql wont know what's going on because you're not limiting
your values.

update <tablename> set <field> = '$value';

is more correct. I suggest using debug functions that tells you what
you're trying to do so that you can try the same command in your
database. this way it's easier to see what might be wrong.


Hope this helps.

Atle


---------------------------------------------------------------------
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