Is it possible to use SELECT
state开发者_StackOverflowment in MySQL
such that key of the result-set rows is the actual PK of table rows?
result set = PHP associative arrays
PK is auto-increment
There is no native function to do that.
But you can quite easily iterate that resultset and set keys by your own.
$data = array();
while ($row = mysql_fetch_assoc($result)) {
$data[ $row['id'] ] = $row;
}
精彩评论