php - Checking the value of all a loops value -


I have this loop in PHP which excludes a table of results,

  & Lt; Table cells = "0" cellpadding = "3" & gt; & Lt; TR & gt; & Lt; Td> & Lt; B & gt; Content Image Title & lt; / B & gt; & Lt; / Td> & Lt; Td> & Lt; B & gt; Content image type & lt; / B & gt; & Lt; / Td> & Lt; Td> & Lt; B & gt; Headline image & lt; / B & gt; & Lt; / Td> & Lt; Td> & Lt; B & gt; From the image of the content & lt; / B & gt; & Lt; / Td> & Lt; Td> & Lt; B & gt; Date Created & lt; / B & gt; & Lt; / Td> & Lt ;! - & lt; Td> & Lt; B & gt; Uploaded by & lt; / B & gt; & Lt; / Td> - & gt; & Lt; / TR & gt; & Lt ;? Php $ colors = array ("# ​​f9f9f9", "# f3f3f3"); $ Count = 0 ;? & Gt; & Lt ;? Php foreach ($ allContentImages $ contents as images):? & Gt; & Lt; Tr bgcolor = "& lt ;? php resonance $ color [$ count ++% count ($ color)] ;; & gt; Gt; & Lt; Td> & Lt ;? Php echo "& lt; a href = '#' class = 'screenshot' rel = '/ media / uploads / $ content images [range id] / $ content images [contentImageName]' & gt; $ ContentImages ['contentImageName']; ? & Gt; & Lt; / TD & gt; & Lt; Td> & Lt ;? Php resonance $ content image ['contentImageType']; ? & Gt; & Lt; / TD & gt; & Lt; Td> & Lt ;? Php if $ content image ['headline image'] == 1) {echo "y";} and {resonant "n";}? & Gt; & Lt; / Td> & Lt; Td> & Lt ;? Php resonance $ content image ['contentTitle']? & Gt; & Lt; / Td> & Lt; Td> & Lt ;? Php Echo Date ("D-M-Y", $ Content Image ['Content Image Uploaded']); ? & Gt; & Lt; / TD & gt; & Lt; Td align = "left" & gt; A class = "delete" href = " & Lt; / A & gt; & Lt; / Td> & Lt; / TR & gt; & Lt ;? Php if ($ contentImages ['headlineEyge'] == '0') {resonant "and lt; tr bgcolor = 'red'> gt; Resonant "& lt; td & gt; & lt; p & gt; You need to specify a headline image & lt; / p & gt; & lt; / td & gt;"; Echo "& lt; / tr & gt;"; ? & Gt; & Lt ;? Php endforeach; ? & Gt; & Lt; / Table & gt;  

I should see every piece of content from the same title as the title page, and if neither a new line is resonated with red ... but whatever I get is New is every time the line is an image that is not a title image Can someone help me? I do not feel like using Javascript if I help match TD values? But obviously my attempt is not right.

Looks like what you want to do, because foreach loop future Can not know about the content of

Perhaps something like this before your foreach statement:

  $ contentHasHeadlineImage = array (); Foreign currency ($ allContentImages $ contentImages) {if ($ contentImages ['headline image'] == 1) $ contentHasHeadlineImage [$ contentImages ['contentTitle']] = true; }  

and then you can use

  (if array_key_exists ($ contentImages ['contentTitle'], $ contentHasHeadlineImage)) {// headline Image is ..}  

to verify whether the title is in a fixed title.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -