Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Not sure, but I think you may have a problem in this part :</p> <pre><code>foreach ($listxml-&gt;ProgramList as $program) { $letter = substr($program-&gt;MajorDescription, 0, 1); if (strcasecmp($letter, $l) == 0) { foreach ($majors as $major){ echo "&lt;p&gt;".$major."&lt;/p&gt;"; } //this is where the problem is - this is always coming back true even if the major is in the array if (!in_array($program-&gt;Program, $majors)) { echo "&lt;a href='../program/?major=".$program-&gt;Program."' class='programLink'&gt;".$program-&gt;Program." - ".strtoupper($program-&gt;MajorDescription)."&lt;/a&gt; - &lt;a target='_BLANK' href='http://www.ontariocolleges.ca/SearchResults/GEORGIAN/_/N-1z1419r?Ntt=".rawurlencode($program-&gt;MajorDescription)."&amp;Ns1=Program_Title_SORT&amp;Ns2=0&amp;Qo=20&amp;SearchWithin=on'&gt;Apply Now&lt;/a&gt;&lt;br /&gt;"; array_push($majors, $program-&gt;Program); } $count++; } } </code></pre> <p>For each element in <code>$listxml-&gt;ProgramList</code> you'll print all your <code>$majors</code>.</p> <p>You should try to put the </p> <pre><code> foreach ($majors as $major){ echo "&lt;p&gt;".$major."&lt;/p&gt;"; } </code></pre> <p>loop after of the <code>foreach ($listxml-&gt;ProgramList as $program) {</code> loop.</p> <p>Also you do the same test twice :</p> <pre><code>foreach ($listxml-&gt;ProgramList as $program) { $letter = substr($program-&gt;MajorDescription, 0, 1); if (strcasecmp($letter, $l) == 0) { </code></pre> <p>Maybe you can optimize your script a little by putting the both blocks together ?</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.
    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