Simple way to read single record from MySQL

后端 未结 20 1304
一整个雨季
一整个雨季 2020-11-30 23:46

What\'s the best way with PHP to read a single record from a MySQL database? E.g.:

SELECT id FROM games

I was trying to find an answer in t

20条回答
  •  一生所求
    2020-12-01 00:31

    I could get result by using following:

    $resu = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM employees1 WHERE pkint =58"));
    echo ( "
    ". $resu['pkint']). "
    " . $resu['f1'] . "
    " . $resu['f2']. "
    " . $resu['f3']. "
    " . $resu['f4' ];

    employees 1 is table name. pkint is primary key id. f1,f2,f3,f4 are field names. $resu is the variable shortcut for result. Following is the output:


    58
    Caroline
    Smith
    Zandu Balm

提交回复
热议问题