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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.