Jump to content

Using a mysql function to select a multidemi array?


Monkuar

Recommended Posts

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

 

captureznh.png

 

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?  :P

 

 

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? :P would that be faster?

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.