PHPfolife Posted September 19, 2009 Share Posted September 19, 2009 Hello, I am trying to explode with php the field from the DB but every time i try to I just get the text Array. $q = "SELECT id,name FROM kb_names WHERE id = '$catId'"; $r = $mysqli->query($q); $row = $r->fetch_object(); echo $row->name; This echoes out one,two,three. Now when i try to explode the comma from that, I did this: $links = $row->links; echo $links; $pieces = explode(",", $links); echo $pieces; But then this part just displays Array. I don't know why and I have searched and I am getting nothing. Any idea? Thanks in advanced Link to comment https://forums.phpfreaks.com/topic/174778-solved-php-explode-from-mysqli/ Share on other sites More sharing options...
Mark Baker Posted September 19, 2009 Share Posted September 19, 2009 you can't echo arrays, you need to use print_r() Link to comment https://forums.phpfreaks.com/topic/174778-solved-php-explode-from-mysqli/#findComment-921106 Share on other sites More sharing options...
khr2003 Posted September 19, 2009 Share Posted September 19, 2009 since you exploded the $links it becomes an array, and the way to read is like $pieces[0], $pieces[1] ,$pieces[2] and so on just link another array. If you want to print an array use print_r() function Link to comment https://forums.phpfreaks.com/topic/174778-solved-php-explode-from-mysqli/#findComment-921108 Share on other sites More sharing options...
PHPfolife Posted September 19, 2009 Author Share Posted September 19, 2009 Thank you very much Mark Baker and khr2003 got it solved Link to comment https://forums.phpfreaks.com/topic/174778-solved-php-explode-from-mysqli/#findComment-921295 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.