php - Break out of foreach loop, echo, then continue the foreach? -


I have a little script which runs only one query, gets all the categories in the database, and then a Lists the top of the second.

  if ($ all_categories) {foreach ($ c_c = & gt; $ all $= as all_categories) {$ Sidebar. = '& Lt; A href = "index.php? Action = sort and seed = '. $ Cid.' "& Gt; '. $ Arr ['name'] '('. $ Arr ['count']. ') & Lt; / A & gt; & Lt; Br / & gt; '; }}} And {$ sidebar = 'There are no categories yet'; }  

Actually, I need this code to loop through the first 10 results, then echo some HTML div and then back up in the loop. I'm new though and not sure how I would have to do this. I was thinking of adding a counter but I was not sure it would be the right way.

  if ($ all_categories) {$ count = 1; ($ Cid = & gt; $ arr) as foreach ($ all_categories) {$ Sidebar. = '& Lt; A href = "index.php? Action = sort and cid = '. $ Cid." "& Gt; '$ arr [' name ']' ('. $ Arr [' count '].') & Lt; / a & gt; 

(10 == $ Counts) {$ Sidebar. = 'After Code 10', this code is shown in the fire. ';} $ Count ++;}} and {$ sidebar =' there are no categories yet ';}

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -