Jump to content

Arrayed Data


viviosoft

Recommended Posts

Hello all,

 

Okay, I have one for ya.  I have the following arrayed data:

 

<?php

$fetch = mysql_query("SELECT * FROM plist WHERE item_num REGEXP '^$param' LIMIT 5"); 

/* Retrieve and store in array the results of the query.*/

while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {

	$row_array['euc'] 	        = $row['euc'];
	$row_array['value'] 		= $row['item_num'];
	$row_array['item_disc'] 	= ucfirst(strtolower($row['item_disc_1']));
	$row_array['item_cost'] 	= $row['price'];

        array_push($return_arr,$row_array);
    }

?>

 

I can get the data I'm after just fine in the above array.  However,  I want to go a step further and get some more data from another table in the same database.  The data in the second table is serialized and relates to the data in the first table which is NOT serialized.  The data in the first array has a id that relates to both tables (euc).

 

I can't seem to figure out how to fetch the data from the second table that has the serialized data in it. So I can output the related data from both tables for each row fetched. 

 

I understand that UNION or JOIN might work but since the data in the second table is serialized I'm not sure those methods will work.  Any ideas how I can make this work?  Thanks for any help on this one guys!!

 

Link to comment
Share on other sites

If I understand correctly, you have ids in it's own column for both of the tables. What I would do is create a new array called $ids which you will fill up during the query result above. Then implode() that array using a a comma delimiter so you can then do WHERE id IN($imploded_ary).

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.