/ / Konverzia mysql_result do msqli - mysql

Prevod mysql_result na msqli - mysql

Snažím sa previesť mysql_result do mysqli.

$total_items = mysql_result(mysql_query($con," SELECT FOUND_ROWS(); "), 0, 0);
$this->items = $data;

odpovede:

1 pre odpoveď č. 1

Zastarané mysql_result sa rovná novému príkazu mysqli mysqli_fetch_field, Preskúmanie nájdete v dokumentácii php.net. Napríklad objektovo orientované:

<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");

/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %sn", mysqli_connect_error());
exit();
}

$query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";

if ($result = mysqli_query($link, $query)) {

/* Get field information for all fields */
while ($finfo = mysqli_fetch_field($result)) {

printf("Name:     %sn", $finfo->name);
printf("Table:    %sn", $finfo->table);
printf("max. Len: %dn", $finfo->max_length);
printf("Flags:    %dn", $finfo->flags);
printf("Type:     %dnn", $finfo->type);
}
mysqli_free_result($result);
}

/* close connection */
mysqli_close($link);
?>

mysqli_fetch_field