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
https://forums.phpfreaks.com/topic/232568-arrayed-data/
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
https://forums.phpfreaks.com/topic/232568-arrayed-data/#findComment-1196291
Share on other sites

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.