Sunday, July 28, 2019

mysqli_fetch_array, list() e MYSQLI_NUM

mysqli_fetch_array is a function that recovers an array of results from a succesfull MySQL query. It can be used with the optional arguments of MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH that will determine how the array will be called.

list() is a language construct that allows a group of variables to receive values from an array like they were one.

list($task_id, $parent_id, $task) = mysqli_fetch_array($r, MYSQLI_NUM) basically this gets the array of results from a SQL query and fills the variables inside the list with its contents treating them as an array. As list() only works with numerically indexed variables we used mysqli_fetch_array with the MYSQLI_NUM argument.

0 comments:

Post a Comment