Note that there are some explanatory texts on larger screens.

plurals
  1. POLooping - I am just struggling with this
    primarykey
    data
    text
    <p>OK, I have stared at this code for hours now scratching my head knowing that there is a way to do what I need to do but am going loopy trying to figure it OUT :/</p> <p>Basically I have images within a subfolder and each subfolder has a view. What I need to do is output the names of the files with an appended number in each subfolder with each view.</p> <p>Now I have the loop working for appending the number to the filenames with a single subfolder type, but what I want to do is iterate trough each subfolder and out put the same thing but for every subfolder instead of just one. </p> <pre><code>$ticker = "RRST"; $i = 0; $last = ''; $query = mysql_query( "SELECT * FROM baseimage JOIN art ON base_folder = series_code WHERE art.ticker = '$ticker' ORDER BY base_folder" ); if( !$query ) { die( mysql_error() ); } while($row = mysql_fetch_array($query)) { if( $row['COUNT(base_folder)'] &lt; 1 &amp;&amp; $row['image_type'] == 'B' &amp;&amp; $row['view'] == 'FF' ) { if( $last !== $row['base_folder'] ) { $i = 0; } echo $row['base_folder']."-".$i++; echo "&lt;br /&gt;"; $last = $row['base_folder']; echo "&lt;hr /&gt;"; } } </code></pre> <p>Now this is working but I would like to change this line:</p> <pre><code>if( $row['COUNT(base_folder)'] &lt; 1 &amp;&amp; $row['image_type'] == 'B' &amp;&amp; $row['view'] == 'FF' </code></pre> <p>so that the it loops through the multiple ['image_type'] and the multiple ['view'], unstead of hard coding the <strong>image_type</strong> and <strong>view</strong> </p> <p>Can anyone help me with this please? </p>
    singulars
    1. This table or related slice is empty.
    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.
    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