Jump to content

[SOLVED] while($row = mysql_fetch_array($result))


johnwayne77

Recommended Posts

i have a classifieds system which i recently launched it.

 

i get each classified in the system by ---while($row = mysql_fetch_array($result))--- which loops until it reaches the end of the table

 

i really need to place ads in the classified page, let's say after 5 classifieds i need a banner placed

 

how can i halt loop to insert code then continue loop

 

any ideas?

 

 

Link to comment
https://forums.phpfreaks.com/topic/146238-solved-whilerow-mysql_fetch_arrayresult/
Share on other sites

great... i'm not sure how to use the increment in the while because i have a smarty template.

 

i tried:

 

{php} $i = 1; {/php}

{foreach item=ad from=$ads}

{php} $i++ {/php} 

<tr class="{cycle values=",alt"}">

<td class="pointer"><a href="{$ad.LINK}" title="{$ad.TITLE|escape}">

{if $ad.SPECIAL}{/if}<b>{$ad.TITLE}</b></a> (<span class="pretrosu">{$ad.PRET}</span>) <br /> {$ad.DESCRIPTION|truncate:150:"...":true} - <a href="{$ad.LINK}" title="{$ad.TITLE|escape}">detalii...</a>{if $ad.SPECIAL}{/if}</a><br /></td>

 

<td><div align="center">{$ad.REGDATE}<br />

  {$ad.IMAGEYESNO}</div></td>

</tr>

{if $i == 5} <b>hi</b> 

{php} $i = 1; {/php}

{/if}

 

but no luck..

 

any advices?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.