Php Array Check If Index Exists In Sql