Note that there are some explanatory texts on larger screens.

plurals
  1. POCollect information from two tables in foreaches
    primarykey
    data
    text
    <p>I have the image product ID in one database table and the image Source in another table. These are all put into an order. There can be more than one image in a single order. I am trying to send each picture to Pwinty.</p> <p>So for each image I need to make this: </p> <pre><code>$photo = $pwinty-&gt;addPhoto($order, "$size", "$source", "$qty", "ShrinkToFit"); // I have not got to the size and qty variable yet // Because of that I have this instead $photo = $pwinty-&gt;addPhoto($order, "4x6", "$source", "1", "ShrinkToFit"); </code></pre> <p>Right now, because they are in multiple tables I have the following code: (which is not returning the photo array above at all. </p> <pre><code>// Get the customers pictures for this order foreach ($db-&gt;query("SELECT * FROM order_products WHERE order_id=$order_id") as $row) $picture_info[] = $row; if (count($picture_info) &gt; 0): foreach ($picture_info as $row): $product_id = $row['product_id']; echo $product_id; foreach ($db-&gt;query("SELECT * FROM products WHERE product_id=$product_id") as $row) $picture_source[] = $row; foreach ($picture_source as $row): $source = $row['product_image']; echo $source; // add some photos $photo = $pwinty-&gt;addPhoto($order, "4x6", "$source", "1", "ShrinkToFit"); endforeach; endforeach; endif; </code></pre> <p>What it is returning is: </p> <pre><code>14138646283376c471632817da60f95964cb2d57dc46.png Array ( [id] =&gt; 7776 [address1] =&gt; 2002 E Blain [address2] =&gt; [postalOrZipCode] =&gt; 68460 [country] =&gt; United States [addressTownOrCity] =&gt; Belvidear [recipientName] =&gt; Joe Dohn [textOnReverse] =&gt; Photos by AlphaHQ [stateOrCounty] =&gt; Kansas [status] =&gt; NotYetSubmitted [payment] =&gt; [paymentUrl] =&gt; [photos] =&gt; Array ( ) [documents] =&gt; Array ( ) [stickers] =&gt; Array ( ) ) </code></pre> <p>See how the image array is empty? What do I need to fix?</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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