Monkuar Posted May 19, 2012 Share Posted May 19, 2012 Here is my query: $db->query("SELECT cache.*,u.username from search_cache cache LEFT Join users as u ON u.id = 'NEED HELP HERE' where ident = '{$username}' ORDER BY DATE DESC") or error('Unable to send the message.', __FILE__, __LINE__, $db->error()); Here is my data inside my search_cache Here is my while loop: while($recent = $db->fetch_assoc($rec)){ $data = unserialize($recent['search_data']); } Now I can use $data['search_type'] as a array and If I use echo $data['search_type']['2'] it echo's out the user_id 32 as seen in the screenshot at the very end. Problem is, I want to use that 'NEED HELP HERE' to join with that id 32 dynamically, how the hell is that possible with mysql or is it? Or would it be easier to just add a new row/column named user_id and just join of that instead of trying to do all this? would that be faster? Quote Link to comment https://forums.phpfreaks.com/topic/262763-using-a-mysql-function-to-select-a-multidemi-array/ Share on other sites More sharing options...
trq Posted May 19, 2012 Share Posted May 19, 2012 Storing serialised (or even simple comma separated data) data is never a good idea for this very issue. It's nopt something that is easily searched or manipulated using a database. Whatever that data is, if it needs to be stored in a database there is a better way. Quote Link to comment https://forums.phpfreaks.com/topic/262763-using-a-mysql-function-to-select-a-multidemi-array/#findComment-1346765 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.