List:General Discussion« Previous MessageNext Message »
From:Haig (Home) Date:June 4 2007 4:11am
Subject:Problem with UPDATE
View as plain text  
Hi everyone,

I have a form where you fill out "description" from a textarea and on
submit, it updates description in mytable.

This works fine. I want to also add the current date into description in my
table.


Here's what I get:



$date = date ("F d Y");
$sql = "UPDATE mytable SET description= '$date $description' WHERE id=$id";
      $result = mysql_query($sql);

1st time I enter data in the form, the output is fine:

Current date followed by the data.

2nd time I enter data into the form, the output is like so:
 
Current date (from the 2nd time I filled out the form) followed by current
date (from the 1st time I filled out the form) followed by 1st data then 2nd
data.



By putting $date after $descrption
$date = date ("F d Y");
$sql = "UPDATE mytable SET description= '$description $date ' WHERE id=$id";
      $result = mysql_query($sql);

I get a better result:

Data followed by date (1st time filling the form)
Data followed by date (2nd time filling the form)  

Anyone know how I can get B but have the date before the data?

Thanks

Haig






Thread
Using the last_insert_id() functiongwh2 Jun
  • Re: Using the last_insert_id() functionBaron Schwartz2 Jun
    • Problem with UPDATEHome)4 Jun