Php Array Check If Index Exists Sql Query To Create