|
Posted by Rich on 04/21/06 19:49
On Fri, 21 Apr 2006 17:17:25 +0100, Mark D. Smith wrote...
>
>Hi
>
>i am trying to update a group of values in 1 table all at once.
>
>my sql string is
>
>$sql = "UPDATE job_adverts (Posted_ID, Date_Posted, Job_Title, Job_Code,
>Job_Location, Job_Salary, Job_Description, Company_image, Contact_Name,
>Contact_Email, Contact_Web, Contact_Company, Contact_Address,
>Contact_Telephone, Contact_Fax, company_id, views) SET ('$Posted_ID',
>'$Date_Posted', '$Job_Title', '$Job_Code', '$Job_Location', '$Job_Salary',
>'$Job_Description', '$Nom_Image', '$Contact_Name', '$Contact_Email',
>'$Contact_Web', '$Contact_Company', '$Contact_Address',
>'$Contact_Telephone', '$Contact_Fax', '$company_id', '$views') WHERE
>ID='$ID'";
>
>but this fails, how should i re-write it? its based on the INSERT INTO code
>below which works.
>
>$sql = "INSERT INTO job_adverts (ID, Posted_ID, Date_Posted, Job_Title,
>Job_Code, Job_Location, Job_Salary, Job_Description, Company_image,
>Contact_Name, Contact_Email, Contact_Web,
>Contact_Company, Contact_Address, Contact_Telephone, Contact_Fax,
>company_id, views) VALUES ('$ID', '$Posted_ID', '$Date_Posted',
>'$Job_Title', '$Job_Code', '$Job_Location', '$Job_Salary',
>'$Job_Description',
>'$Nom_Image', '$Contact_Name', '$Contact_Email', '$Contact_Web',
>'$Contact_Company', '$Contact_Address', '$Contact_Telephone',
>'$Contact_Fax', '$company_id', '0')";
>
>
>Mark
>
The syntax for an UPDATE is a bit different than an INSERT. It should look
closer to this, replacing "......" with the rest of the updates
UPDATE job_adverts SET
ID = '$ID',
Posted_ID = '$Posted_ID',
Date_Posted = '$Date_Posted',
.......
views = '$views'
WHERE ID = '$ID';
Rich
--
NewsGuy.Com 30Gb $9.95 Carry Forward and On Demand Bandwidth
Navigation:
[Reply to this message]
|