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 ) ) Quote 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 Quote 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 "); Quote Link to comment https://forums.phpfreaks.com/topic/234016-array/#findComment-1202828 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.