Php số lượng mysqli_fetch_array

mysqli_report[MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT];
$mysqli = new mysqli["localhost", "my_user", "my_password", "world"];

$query = "SELECT Name, CountryCode FROM City ORDER BY ID LIMIT 3";
$result = $mysqli->query[$query];

/* numeric array */
$row = $result->fetch_array[MYSQLI_NUM];
printf["%s [%s]\n", $row[0], $row[1]];

/* associative array */
$row = $result->fetch_array[MYSQLI_ASSOC];
printf["%s [%s]\n", $row["Name"], $row["CountryCode"]];

/* associative and numeric array */
$row = $result->fetch_array[MYSQLI_BOTH];
printf["%s [%s]\n", $row[0], $row["CountryCode"]];

mysqli_report[MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT];
$mysqli = mysqli_connect["localhost", "my_user", "my_password", "world"];

$query = "SELECT Name, CountryCode FROM City ORDER by ID LIMIT 3";
$result = mysqli_query[$mysqli, $query];

/* numeric array */
$row = mysqli_fetch_array[$result, MYSQLI_NUM];
printf["%s [%s]\n", $row[0], $row[1]];

________số 8_______

/* associative and numeric array */
$row = mysqli_fetch_array[$result, MYSQLI_BOTH];
printf["%s [%s]\n", $row[0], $row["CountryCode"]];

my_personal_contacts

  • Connected with MySQL by phpMyAdmin, v. v.  
  • Tạo cơ sở dữ liệu có tên my_person_contacts
  • Thi tập lệnh hiển thị bên dưới để tạo bảng và chèn một số dữ liệu demo
  • TẠO BẢNG NẾU KHÔNG TỒN TẠI `my_contacts` [

    `id` int[11] KHÔNG NULL AUTO_INCREMENT,

    `full_names` varchar[255] KHÔNG NULL,

    `giới tính` varchar[6] KHÔNG NULL,

    `contact_no` varchar[75] KHÔNG NULL,

    `email` varchar[255] KHÔNG NULL,

    `city` varchar[255] KHÔNG NULL,

    `quốc gia` varchar[255] KHÔNG NULL,

    ] ENGINE = InnoDB  DEFAULT CHARSET = latin1 AUTO_INCREMENT = 5 ;

    CHÈN VÀO `my_contacts` [

    [1, 'Zeus', 'Nam', '111', 'zeus@olympus. tấn. co', 'Agos', 'Hy Lạp'],

    [2, 'Athena', 'Nữ', '123', 'athena@olympus. tấn. co', 'Athens', 'Hy Lạp'],

    [3, 'Jupiter', 'Nam', '783', 'jupiter@planet. điểm. co', 'Rome', 'Ý'],

    [4, 'Venus', 'Female', '987', 'venu @planet. điểm. co', 'Mars', 'Ý'];


    Chủ Đề