Welcome Guest, Not a member yet? Register   Sign In
multiple query and foreach loop
#4

[eluser]forzaferrari87[/eluser]
[quote author="CroNiX" date="1388161737"]client
-id
-name

projects
-id
-client_id
-description

Code:
SELECT client.name, projects.description
FROM client
JOIN projects on client.id = projects.client_id
ORDER BY client.name

will list each client name along with all of their project descriptions[/quote]

Your SQL query is right, but I want it to do with where, because my target in the viewis this
Code:
<?php foreach($cats as $cats_item): ?>
<table class="table">
<tr><td>&lt;?php echo $cats_item['lcatname']; ?&gt;</td></tr>
&lt;?php foreach($links as $links_item): ?&gt;
<tr><td><a href="&lt;?php echo $links_item['linkurl']; ?&gt;" target="_blank">&lt;?php echo $links_item['linkname']; ?&gt;</a></td></tr>
&lt;?php endforeach; ?&gt;
</table>
&lt;?php endforeach; ?&gt;

i think this i can only make with where or there are another solution in codeigniter for printing out a category loop and into this one a link loop?


Messages In This Thread
multiple query and foreach loop - by El Forum - 12-27-2013, 05:19 AM
multiple query and foreach loop - by El Forum - 12-27-2013, 09:25 AM
multiple query and foreach loop - by El Forum - 12-27-2013, 09:28 AM
multiple query and foreach loop - by El Forum - 12-27-2013, 10:17 AM
multiple query and foreach loop - by El Forum - 12-27-2013, 10:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB