Huh.. Can you post your code ? (because I have never heard of this problem before!)
nav33n
Purple hazed!
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
Hello,
the update command looks like this:
UPDATE tbl_name SET col1='value1', col2='value2', col3='value3'
WHERE some conditions comes here
silviuks
Junior Poster in Training
96 posts since Apr 2006
Reputation Points: 10
Solved Threads: 15
Are you sure all columns are of type string ? We could be of more help if you post the table structure.
Have you tried:
mysql_query(...) or die(mysql_error());
to see if there is an error ?
pritaeas
Posting Expert
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
Hello..
Try this code to update three or more fields in database:
$qur= "update `users` set `username`='".$_POST['username']."', `password`='".$_POST['password']."', `name`='".$_POST['name']."', `email`='".$_POST['emailid']."', `phone`='".$_POST['phoneno']."', `country`='".$_POST['country']."', `county`='".$_POST['county']."', `city`='".$_POST['city']."', `pincode`='".$_POST['zip']."', `shipping`='".$_POST['shipping']."', `billing`='".$_POST['billing']."', `organisation`='".$_POST['org']."', `fax`='".$_POST['fax']."' where id=".$_GET['id'];
mysql_query( $qur) ;
I think it will work properly after this...
ShantI
Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
if somebody could point out the error..
mysql_query("update client set dod='$dod', mod='$mod',yod='$yod' where id='$id'");
seems perfectly fine. Your 3 queries are also fine. I don't see any error as there isn't any.
nav33n
Purple hazed!
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
Okay. Do this.
$query = "update client set dod='$dod', mod='$mod',yod='$yod' where id='$id'";
echo $query;
mysql_query($query);
Tell us what it prints.
nav33n
Purple hazed!
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
What exactly does it print ?
nav33n
Purple hazed!
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
Strange! Now, execute this query in mysql console or phpmyadmin. If it still doesn't update, check the column datatype. :S I don't see any problem with the query.
nav33n
Purple hazed!
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
Oh, and isn't "mod" a PHP or MySQL reserved word? That could very well be the other part of your problem.
Ah! Exactly. You nailed it. This will do.
update client set dod='10', `mod`='4',yod='2008' where id='120'
Notice the extra` around mod. It will make a keyword to be used 'without any error'. But, its not a good thing to have keywords as columnnames.
Cheers,
Naveen
Edit: mod is a mysql reserve word.
nav33n
Purple hazed!
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356