私は私の関数をビルドしようとすると、この問題が発生します!私はデータベースにレコードを取得する関数を構築する必要があります!基づいて、database.phpでPHP:レコードを取得する関数ですがエラー:未定義のプロパティ
function db_get_row($sql){
db_connect(); // Connect to Database
global $connect; // Get Global Variable
$row = array(); // Create array
$result = $connect->query($sql); // Excute the query and return a record
if($result->num_rows > 0){ // If record > 0 -> TRUE
$row = $result->fetch_assoc; // I get that record into $row HERE IS MY ERROR
}
return $row; // Return array
}
可能な重複する必要がhttp://php.net/manual/en/mysqli-result.fetch-assoc.php
[ PHP: "通知:未定義変数"、 "通知:未定義インデックス"、 "通知:未定義オフセット"](https://stackoverflow.com/questions/4261133/php-notice-undefined-variable-notice-undefined-index -and-notice-undef) –
phpに関数があることを示す()がありません –
はい、fetch_assocは結果セットから行をフェッチする関数/メソッドのように見えます –