Jump to content

randomly display with counting


sayen

Recommended Posts

15 rows selected from the table.

I want to randomly display an ad between them.

 

Here's the code:

$count = 1;   

(mysql select rows)

$number = rand (1,15);
		if ($count == $number)
        {
	echo 'ad code


                     ';
	}
$count++;

 

I want the ad to be displayed only once and in the above code, depending on the generated number by rand() matching the $number the ads will be displayed more times.

How can I limit this only to one?

Link to comment
https://forums.phpfreaks.com/topic/249148-randomly-display-with-counting/
Share on other sites

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.