andz Posted August 13, 2007 Share Posted August 13, 2007 I'm using explode() to extract and make an array() readable. I'm able to make the array() from dbase readable. categories_table { catid name 1 'test1' 2 'test2' 3 'test3' } implode_table { email catid test@local 1,2,3 help@local 2,3 } For example, if test@local logged in to the system, how can test@local load all the information of the catid he selected? My code for the moment fetch only all the catid that's being saved under test@local account. foreach (getImplodeCategoriesByEmail($email) as $explodeCat) { $delimiter = ","; $content = $explodeCat['catid']; $splitContent = explode($delimiter, $content); foreach ($splitContent as $result) { echo $result; } } Assume that getImplodeCategoriesByEmail($email) is fetching all the records that match the email. This piece of code worked. It gives me a result of 123. THE PROBLEM: HOW CAN I LOAD ALL THE INFORMATION OF THE EXTRACTED CATID??? The output should be like this 1 test1 2 test2 3 test3 What query AND how to implement it? If possible, please include code.... THANKS and MORE POWER!!! Quote Link to comment https://forums.phpfreaks.com/topic/64623-solved-need-help-on-how-to-retrieve-the-respective-value-of-array-from-another-table/ Share on other sites More sharing options...
gurroa Posted August 13, 2007 Share Posted August 13, 2007 As long as you don't want to add another table (it would be more efficient) you can use $catids = getImplodeCategoriesByEmail($email); if (!empty($catids)) { $query = "select catid, name from categories where catid in (".$catids.")"; // select catid, name from categories where catid in (1,2,3) } Quote Link to comment https://forums.phpfreaks.com/topic/64623-solved-need-help-on-how-to-retrieve-the-respective-value-of-array-from-another-table/#findComment-322180 Share on other sites More sharing options...
andz Posted August 13, 2007 Author Share Posted August 13, 2007 Should it load all the values of the saved array()??? Quote Link to comment https://forums.phpfreaks.com/topic/64623-solved-need-help-on-how-to-retrieve-the-respective-value-of-array-from-another-table/#findComment-322184 Share on other sites More sharing options...
gurroa Posted August 13, 2007 Share Posted August 13, 2007 Yes. if (!empty($catids)) { $query = "select catid, name from categories where catid in (".$catids.")"; // select catid, name from categories where catid in (1,2,3) $res = mysql_query($query); while($row = mysql_fetch_assoc($res)) $ar_cate[] = $row['catid'].' '.$row['name']; } Quote Link to comment https://forums.phpfreaks.com/topic/64623-solved-need-help-on-how-to-retrieve-the-respective-value-of-array-from-another-table/#findComment-322189 Share on other sites More sharing options...
andz Posted August 13, 2007 Author Share Posted August 13, 2007 I'll give it a try, could I get your email address so that I can contact you anytime Quote Link to comment https://forums.phpfreaks.com/topic/64623-solved-need-help-on-how-to-retrieve-the-respective-value-of-array-from-another-table/#findComment-322192 Share on other sites More sharing options...
gurroa Posted August 13, 2007 Share Posted August 13, 2007 My email is public. So yes. Quote Link to comment https://forums.phpfreaks.com/topic/64623-solved-need-help-on-how-to-retrieve-the-respective-value-of-array-from-another-table/#findComment-322197 Share on other sites More sharing options...
andz Posted August 13, 2007 Author Share Posted August 13, 2007 thanks bro... Godspeed. I'll contact you maybe tommorow. Got no internet connection at home. I'm at the cafe at the moment. Quote Link to comment https://forums.phpfreaks.com/topic/64623-solved-need-help-on-how-to-retrieve-the-respective-value-of-array-from-another-table/#findComment-322205 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.