Page 1 of 1
phpMyAdmin, change data
Posted: Thu Jan 02, 2003 8:19 pm
by kid_am
sorry, i'm a newbie

and i don't know how to change some data in a table. I only see a possibility to enter a whole new row... thx!
Posted: Thu Jan 02, 2003 8:55 pm
by Gen-ik
Use something like this...
Code: Select all
<?php
$change_from_this="Bob";
$change_to_this="Mike";
mysql_query(" UPDATE `your_table` SET `name`='$change_to_this' WHERE `name`='$change_from_this' ");
?>
If you don't know the value you want to change then just do this..
Code: Select all
<?php
$change_to_this="Red";
mysql_query(" UPDATE `your_table` SET `colour`='$change_to_this' ");
?>
Hope this helps.
Posted: Fri Jan 03, 2003 4:29 am
by kid_am
thx! but is it necessary to enter this whole stuff in phpmyadmin? Isn't there a much easier solution? thx anyway!
Posted: Fri Jan 03, 2003 8:32 am
by Gen-ik
Sorry I don't understand what you mean.
The above script would be used in a PHP page and unless you want to do it by deleting an old row and entering a new one it's basically the easiest way of changing data.
If you want to change the information manually then use phpmyadmin.
If you don't know how to use phpmyadmin then read the manual.
slect browse
Posted: Sat Jan 04, 2003 12:03 pm
by phpScott
In phpMyAdmin if that is what I understand you are using
On the left side select the table that has the row you wich to update.
Select browse and keep clicking the > button until you see the row that needs to be updated.
Click on edit, the page will the turn into a form that will allow you to edit the data.
At the bottom click save.
Or if you have a large table you can run an SQL query to limit the result set, but if you are going through that effort you might as well run a SQL script that uses UPDATE.
phpScott