-2
我想從一個MySQL數據庫的信息,我有下面的代碼。我試圖使用其他頁面上發現的編輯,但我是編程新手,無法弄清楚我做錯了什麼。類型「任何」沒有標會員,indexPath
func get(){
let url = URL(string: "http://192.168.157.134/Getdepartment.php")
let data = try? Data(contentsOf: url!)
values = try! JSONSerialization.jsonObject(with: data!, options: JSONSerialization.ReadingOptions.mutableContainers) as! NSArray
tableView.reloadData()
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return values.count;
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! SpecialCell
let maindata = values[indexPath.row]
cell.username.text = maindata["Username"] as? String
cell.password.text = maindata["Password"] as? String
cell.num.text = maindata["FavoriteNumber"] as? String
cell.info.text = maindata["Info"] as? String
return cell;
}