Note that there are some explanatory texts on larger screens.

plurals
  1. POSorting related pictures to artists - PHP/MySQL
    primarykey
    data
    text
    <p>I need anyones help, i'll really appriciate that.</p> <p>I have made 2 JOiN-s. As a fact I have 3 Tables</p> <ol> <li>Table with names of Artists (m)</li> <li>Table with Product iformations, in this case Picture addresses (p)</li> <li>Table that has id of Artists and id of Products. (pmx)</li> </ol> <p>here's the SELECT statement:</p> <pre><code>SELECT m.manufacturer_id , m.mf_name , p.product_id , p.product_full_image FROM jos_vm_product_mf_xref AS pmx JOIN jos_vm_manufacturer AS m ON m.manufacturer_id = pmx.manufacturer_id JOIN jos_vm_product AS p ON p.product_id = pmx.product_id WHERE m.mf_chars = 'm' </code></pre> <p>the effect that I'm trying to achieve is like on [http://www.ugallery.com/ArtistList.aspx?RC=1][1]</p> <p>and in fact I'm getting just:</p> <ol> <li>Name1 - prod1</li> <li>Name1 - prod2</li> <li>Name2 - prod1</li> <li>Name1 - prod3</li> </ol> <p>I want it, after foreach (smth) { smth } to get:</p> <ol> <li>Name1 - prod1 prod2, prod3</li> <li>Name2 - prod1 prod2</li> <li><p>Name3....etc</p> <pre><code>&lt;ul&gt; &lt;?php foreach ($this-&gt;artistlist as $item) { ?&gt; &lt;li&gt;&lt;a href="index.php?option=com_virtuemart&amp;page=shop.browse&amp;manufacturer_id=&lt;?php echo $item-&gt;manufacturer_id; ?&gt;"&gt;&lt;?php echo $item-&gt;mf_name; ?&gt;&lt;/a&gt; &lt;a href="index.php?page=shop.product_details&amp;flypage=flypage.tpl&amp;product_id=&lt;?php echo $item-&gt;product_id; ?&gt;&amp;option=com_virtuemart"&gt; &lt;img src="components/com_virtuemart/shop_image/product/&lt;?php echo $item-&gt;product_full_image; ?&gt;" height="75px"&gt; &lt;/a&gt; &lt;/li&gt; &lt;?php } ?&gt; &lt;/ul&gt; </code></pre></li> </ol> <p>this is PHP code that I'm using for now...</p> <p>So plz, plz, plz.... Can anyone help me? </p> <p>Here's the piece of the code</p> <pre><code>foreach ($this-&gt;artistlist as $picture) { if(!isset($artists[$picture['manufacturer_id']])) { &lt;---this is line 22 $artists[$picture['manufacturer_id']] = array( 'name'=&gt;$picture['mf_name'] ); } </code></pre> <p>So... the error: Warning: Invalid argument supplied for foreach() in D:\Server\xampp\htdocs\ta\components\com_artists\views\artists\tmpl\default.php on <strong>line 35</strong></p> <p>foreach($artist['pictures'] as $pictureId=>$pictureFullImage) { &lt;--- line 35</p> <p>And another additional question: the outputed HTML is like this: </p> <pre><code> &lt;ul&gt; &lt;li&gt; &lt;a href="/ta/index.php?option=com_virtuemart&amp;amp;page=shop.browse&amp;amp;manufacturer_id=3"&gt;Giorgi Mihkeil&lt;/a&gt; **&lt;/li&gt;&lt;li&gt;** &lt;--- and, can we get rid of this pieces? *&lt;a href="/ta/index.php?option=com_virtuemart&amp;amp;page=shop.browse&amp;amp;manufacturer_id=$picture-&gt;artist_id"&gt;&lt;/a&gt;* &lt;-- what is this link? where does it come from? &lt;a href="/ta/index.php?page=shop.product_details&amp;amp;flypage=flypage.tpl&amp;amp;product_id=1&amp;amp;option=com_virtuemart"&gt; &lt;img src="/ta/components/com_virtuemart/shop_image/product/Lonely_Boat_4cfa773e83874.jpg" height="75px"&gt; &lt;/a&gt; &lt;a href="/ta/index.php?page=shop.product_details&amp;amp;flypage=flypage.tpl&amp;amp;product_id=2&amp;amp;option=com_virtuemart"&gt; &lt;img src="/ta/components/com_virtuemart/shop_image/product/Naked_Couple_4cfbd12805f5b.jpg" height="75px"&gt; &lt;/a&gt; &lt;a href="/ta/index.php?page=shop.product_details&amp;amp;flypage=flypage.tpl&amp;amp;product_id=4&amp;amp;option=com_virtuemart"&gt; &lt;img src="/ta/components/com_virtuemart/shop_image/product/Lonely_Boat_4d246dbef30e1.jpg" height="75px"&gt; &lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; </code></pre> <p>now this html give's smth like: <code>&lt;ul&gt;&lt;li&gt;NAME &lt;/li&gt;&lt;li&gt; &lt;img1&gt;&lt;img2&gt;&lt;img3&gt; &lt;/li&gt;&lt;/ul&gt;</code> can we get smth like: <code>&lt;ul&gt;&lt;li&gt;NAME &lt;img1&gt;&lt;img2&gt;&lt;img3&gt; &lt;/li&gt;&lt;/ul&gt;</code> ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload