updated php script to dynamically get table name