显示表中的记录?

The code to draw, transfer and delete a record already written. But I do not know how to do to the records displayed the.

The basic idea is:

    $mysqli->query("SET @ROW_ID := (SELECT id FROM klucz ORDER BY RAND() LIMIT 1);");
    echo  $mysqli['game'].  $mysqli['steam'].  ;

Here is the entire code:

        {

        $mysqli = new mysqli("localhost", "root", "", "klucze");

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



/* set autocommit to off */
$mysqli->autocommit(FALSE);

/* Insert some values */
$mysqli->query("SET @ROW_ID := (SELECT id FROM klucz ORDER BY RAND() LIMIT 1);");

    echo  $mysqli['game'].  $mysqli['steam']. "Wylosowana gra to: <BR>Twoj kod do gry:" ;



$mysqli->query("INSERT INTO kluczuzyty SELECT * FROM klucz WHERE id = @ROW_ID;");



/* commit transaction */
$mysqli->commit();

/* drop table */
$mysqli->query("  DELETE FROM klucz WHERE id = @ROW_ID;");







/* close connection */
$mysqli->close();
}

Taking a stab at this, but it still does not make a lot of sense. EDIT I think I understand what you're trying to do now. Take a look.

<?php
$mysqli = new mysqli("localhost", "root", "", "klucze");

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

/* set autocommit to off */
$mysqli->autocommit(FALSE);

if($results = $mysqli->query("SELECT id FROM klucz WHERE ORDER BY RAND() LIMIT 1")){
    while($row = $results->fetch_Assoc()){
        $ROW_ID = $row['id'];
    }
    // Edited after comment
    $results->free();
}
if(isset($ROW_ID)){
    if($results = $mysqli->query("SELECT * FROM klucz WHERE id = $ROW_ID");
        while($row = $results->fetch_assoc()){
            echo  "{$row['game']}{$row['steam']}Wylosowana gra to: <BR>Twoj kod do gry:";
        }
        $results->free();
    }
    $mysqli->query("INSERT INTO kluczuzyty SELECT * FROM klucz WHERE id = $ROW_ID;");
    $mysqli->query("DELETE FROM klucz WHERE id = $ROW_ID;");
}
$mysqli->close();

?>