#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Quispamsis, NB, Canada
    Posts
    49
    Rep Power
    14
    I know this is a php board, but I use php for my stuff and i have a simple MySQL question, and most people who use php use MySQL for their DB anyway.....I want to overwrite a field in a table with new data but can't quite get it right. I want the old stuff to go away and for it to add the variable $ctime.....can anyone help me? Thanks in advance.


    Thanks,
    Scott
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Seattle, WA,USA
    Posts
    84
    Rep Power
    15
    Have you tried the UPDATE command thingy?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Quispamsis, NB, Canada
    Posts
    49
    Rep Power
    14
    yes, i have tried "UPDATE mp3 SET checked = $ctime" but it didnt work....
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Seattle, WA,USA
    Posts
    84
    Rep Power
    15
    hmmmm... more info would be needed.
  8. #5
  9. No Profile Picture
    RyanP
    Guest
    Devshed Newbie (0 - 499 posts)
    is $ctime a string? if so, try

    UPDATE mp3 SET checked = '$ctime'

    also, i assume that you want this field to be modified in every record of the table because you are not specifying a where clause?
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Posts
    79
    Rep Power
    15
    you -have- to specify a where clause

    Basil
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Pune, Maharashtra, India
    Posts
    86
    Rep Power
    15
    Use the update function like :
    $sql="UPDATE mp3 SET checked = '$ctime'WHERE id='$id'";
    $result=mysql_query($sql);


    ------------------
    Nikunj
    MYSQL/PHP/XML
    ** Expertise comes with experiece ** Nikunj
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Quispamsis, NB, Canada
    Posts
    49
    Rep Power
    14
    Thanks for your help guys, actually i had 2 problems. Yes, i need to add "WHERE id=$id" but i also had to move the $ctime variable above the UPDATE command so it actually had something to update with.

    Thanks,
    Scott

Similar Threads

  1. AUTO_INCREMENT... simple question please help
    By phpWhiz420 in forum MySQL Help
    Replies: 1
    Last Post: February 10th, 2004, 07:42 PM
  2. (hopefully) simple SQL in java servlet question
    By djstyli in forum Java Help
    Replies: 3
    Last Post: February 5th, 2004, 07:58 PM
  3. Simple question regarding string evaluation
    By Lobsang in forum PHP Development
    Replies: 3
    Last Post: February 3rd, 2004, 02:28 PM
  4. Just a simple question!
    By Il Capitano in forum Perl Programming
    Replies: 1
    Last Post: January 23rd, 2004, 05:00 PM

IMN logo majestic logo threadwatch logo seochat tools logo