Note that there are some explanatory texts on larger screens.

plurals
  1. POis there a simpler way to write this so the latest entry shows and not previous entries?
    primarykey
    data
    text
    <pre><code>if ($row['note_1'] !== '' &amp;&amp; $row['note_2'] == '' &amp;&amp; $row['note_3'] == '' &amp;&amp; $row['note_4'] == '' &amp;&amp; $row['note_5'] == '' &amp;&amp; $row['note_6'] == '') { echo $row['note_1_user'].":&lt;br /&gt;"; echo $row['note_1']; } if ($row['note_1'] !== '' &amp;&amp; $row['note_2'] !== '' &amp;&amp; $row['note_3'] == '' &amp;&amp; $row['note_4'] == '' &amp;&amp; $row['note_5'] == '' &amp;&amp; $row['note_6'] == '') { echo $row['note_2_user'].":&lt;br /&gt;"; echo $row['note_2']; } if ($row['note_1'] !== '' &amp;&amp; $row['note_2'] !== '' &amp;&amp; $row['note_3'] !== '' &amp;&amp; $row['note_4'] == '' &amp;&amp; $row['note_5'] == '' &amp;&amp; $row['note_6'] == '') { echo $row['note_3_user'].":&lt;br /&gt;"; echo $row['note_3']; } if ($row['note_1'] !== '' &amp;&amp; $row['note_2'] !== '' &amp;&amp; $row['note_3'] !== '' &amp;&amp; $row['note_4'] !== '' &amp;&amp; $row['note_5'] == '' &amp;&amp; $row['note_6'] == '') { echo $row['note_4_user'].":&lt;br /&gt;"; echo $row['note_4']; } if ($row['note_1'] !== '' &amp;&amp; $row['note_2'] !== '' &amp;&amp; $row['note_3'] !== '' &amp;&amp; $row['note_4'] !== '' &amp;&amp; $row['note_5'] !== '' &amp;&amp; $row['note_6'] == '') { echo $row['note_5_user'].":&lt;br /&gt;"; echo $row['note_5']; } if ($row['note_1'] !== '' &amp;&amp; $row['note_2'] !== '' &amp;&amp; $row['note_3'] !== '' &amp;&amp; $row['note_4'] !== '' &amp;&amp; $row['note_5'] !== '' &amp;&amp; $row['note_6'] !== '') { echo $row['note_6_user'].":&lt;br /&gt;"; echo $row['note_6']; } </code></pre> <p>a table with 6 note fields and 6 note user field for a total of 12 fields dealing with notes. there are other fields, but the notes fields are 12.</p> <p>in the add note page it's only possible to write to one set at a time. when going to the page the first time, they add note to field note_1 and the username automatically goes into note_1_user. then the second time going to the page, the note will go into note_2, and the user automatically goes into note_2_user. previous notes do not get over-written.</p> <p>i have a page to view all notes, however, on a different page i just want the latest note to show up. i can't think of a better way to make that happen other than the way i posted above.</p> <p>basically every if statement is the same. they all have the same 6 checks, checking if there is data in the fields, except the first one is checking if one of the 6 is not empty, then the second one checks if two are not empty, and so forth until the last one checks if all 6 are not empty.</p> <p>this seems like too much code to do this effect.</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.
    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