Hello. Im running a gaming website where each game has the possibility to have keywords added to them. insteed of updating 2300 rows manually i was wondering if it is possible to somehow run a query that update the collumn "keyword" for all rows in the table, with what is writen in the row "name" in the same table ?
not sure what you mean, but you want a query to add a keyword to your keyword list? my head kinda hurts now, so if you know php/mysql i'll give you the idea and sample set, if not, well, maybe someone can come along and perfect it //get current value $connect =mysql_connect($dbname, $dbusername, $dbpass); $result=mysql_query("SELECT * from tablename WHERE value"); //unsure what you want here while($row=mysql_fetch_array($result)) { $row2=row."keyword"; mysql_query("UPDATE keyword SET $row2 FROM tablename WHERE value=$row"); } PHP: actually, that's very crude, and very basic, and most likely very unoptimized. im suffering from lack of sleep
im sorry if i made it confusing i want it to copy the text on each row on the collumn "name" for and copy it into each row for the collumn "keyword" for all 2300 rows. kinda like copy paste! how it looks like Name: horde jumping Keyword: what i want Name: horde jumping Keyword: horde jumping
Try this query: $result=mysql_query("UPDATE Tablename SET keyword = name"); Replace Tablename with your actual name of table. Please note that this will replace all rows. You can also add a condition as $result=mysql_query("UPDATE Tablename SET keyword = name WHERE condition");