September 1st, 2000, 11:34 PM
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.
September 1st, 2000, 11:36 PM
Have you tried the UPDATE command thingy?
September 1st, 2000, 11:39 PM
yes, i have tried "UPDATE mp3 SET checked = $ctime" but it didnt work....
September 1st, 2000, 11:52 PM
hmmmm... more info would be needed.
September 2nd, 2000, 12:43 AM
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?
September 2nd, 2000, 05:13 AM
you -have- to specify a where clause
September 2nd, 2000, 05:24 AM
Use the update function like :
$sql="UPDATE mp3 SET checked = '$ctime'WHERE id='$id'";
** Expertise comes with experiece ** Nikunj
September 2nd, 2000, 01:59 PM
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.