dreamwest Posted April 18, 2011 Share Posted April 18, 2011 Ive drawn some database info but i need to change one key value while ($new = mysql_fetch_assoc($res)){ $latest[] = $new; } print_r($latest); which prints: Array ( [0] => Array ( [id] => 1063636 [vid] => 41321 [es_title] => another title ) [1] => Array ( [id] => 1063635 [vid] => 02003 [es_title] => another title ) [2] => Array ( [id] => 1063634 [vid] => 51605 [es_title] => another title ) ) How can i replace [es_title] with just [title] so it looks like this Array ( [0] => Array ( [id] => 1063636 [vid] => 41321 [title] => another title ) [1] => Array ( [id] => 1063635 [vid] => 02003 [title] => another title ) [2] => Array ( [id] => 1063634 [vid] => 51605 [title] => another title ) ) Link to comment https://forums.phpfreaks.com/topic/234016-array/ Share on other sites More sharing options...
PFMaBiSmAd Posted April 18, 2011 Share Posted April 18, 2011 In your query, use title as an alias name for es_title Link to comment https://forums.phpfreaks.com/topic/234016-array/#findComment-1202818 Share on other sites More sharing options...
dreamwest Posted April 18, 2011 Author Share Posted April 18, 2011 Something like this? $res = mysql_query("SELECT *,`es_title` as `title` FROM `table` LIMIT 3 "); Link to comment https://forums.phpfreaks.com/topic/234016-array/#findComment-1202828 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.