php array from mysql

后端 未结 2 1840
说谎
说谎 2021-01-28 07:41

I\'m using PHP to get a value from MySQL. My table has this form:

COL1 = MAIL mail@mail.com
COL2 = NAME myname

and I\'m getting from the databa

2条回答
  •  梦谈多话
    2021-01-28 08:41

    Either specify MYSQLI_ASSOC after your query, or use mysqli_fetch_assoc. from the manual:

    resulttype This optional parameter is a constant indicating what type of array should be produced from the current row data. The possible values for this parameter are the constants MYSQLI_ASSOC, MYSQLI_NUM, or MYSQLI_BOTH.

    By using the MYSQLI_ASSOC constant this function will behave identically to the mysqli_fetch_assoc(), while MYSQLI_NUM will behave identically to the mysqli_fetch_row() function. The final option MYSQLI_BOTH will create a single array with the attributes of both.

    Manual: http://us2.php.net/mysqli_fetch_array

提交回复
热议问题