Patrik Fomin schrieb:

...
q2)
i got like 100 matches from a database into a $num variable,
then i want to devide that by 3 aslong as it can be done, eg:

while ($num != 0) {

ïf ($num / 3 = true){
some code to display some fields from a database

$num = $num - 3;
}
else {
some other code to display
$num = 0;
}
}

basicly i want the if statement to check if its more then 3 posts left to
print out, if not its gonna print out the remaining last 1 - 2 post in a
diffrent way (for the looks)

hi patrik,


for your second question maybe 'modulus' helps you.

<?php
$mod = $num % 3;
?>

gives you your remaining results (0, 1 or 2) depending on division by 3.

another possibility could be the use of 'limit' in your sql-select-statement.

hth SVEN

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to