Ok So Im having a problem.
Im trying to get a script to do this:
Take info from Database: Players
- playerName
- onlinetime
Match playerName with playerName
And put that info into Database: times
With the Colums:
- playerName
- 1-24
- time1-24
- 1-23
- time1-23
- etc etc for all dates.
I just want it to add the snapshot from DB: Players and put it as the row titled by the date.
This is the code I Was using, but It created seperate rows for the player each day instead of Inserting it into the existing row matching the playerName in players
$mytime = date('m-d');
$newcolumn = $mytime;
$query1 = "ALTER TABLE times ADD `$newcolumn` DOUBLE NULL DEFAULT NULL , ADD `time$newcolumn` varchar(45) NULL DEFAULT NULL";
$query2 = "SELECT `playerName`,`onlinetime` FROM `players` WHERE `playerName` != ''";
$query3 = "INSERT INTO times (`playerName`,`$newcolumn`) $query2";
$query4 = "UPDATE times SET `time$newcolumn`='$mytime', $newcolumn=''$query5''";
I need them to UPDATE instead of INSERT but I seem to have gone off course. They wont match up to the playerNames in the new database.
Any help would be greatly appriciated.