portet php to new table structure