Remove duplicate values from PHP array preferring text keys -
when retrieve results database query in php, receive duplicated values, ones integer, , 1 has column name. array_unique(), in sorting array, in cases end numeric key before string, meaning key kept. right now, utilize function removes array numeric key, don't care approach. have improve way this?
change command utilize retrieve values database (eg. mysql_fetch_assoc instead of mysql_fetch_array). no matter api utilize now, there alternative want.
update:
in pdo write:
$nonumindexes = $res->fetch(pdo::fetch_assoc);
php
No comments:
Post a Comment