[SOLVED] printf
Posted: Sun Aug 08, 2004 11:12 pm
Warning: printf() [function.printf]: Too few arguments in line 17
I am trying to get an output in columns, dont know if i am on right track there. but i am trying it like this
1234 1234 1234 1234
1234 1234 1234 1234
1234 1234 1234 1234
ect..
I am trying to get an output in columns, dont know if i am on right track there. but i am trying it like this
1234 1234 1234 1234
1234 1234 1234 1234
1234 1234 1234 1234
ect..
Code: Select all
$columns = 3;
$counter = 0;
echo "<table><tr>";
$query = "SELECT * FROM <table>";
$result = mysql_query($query);
$COLUMNS = (int) 2;
$i = (int) 0;
while ($row = mysql_fetch_array($result)) {
if($i++ == 0) {
printf("<tr>");
}
#line 17 below
printf("<td align=center><a href="%s?id=%s">%s<br>%s</a></td> ", $_SERVER['PHP_SELF'], $row["species"]);
if($i == $COLUMNS) {
printf("</tr>");
$i = 0;
}
}
if($i > 0) {
while($i++ != $COLUMNS) {
printf("<td> </td>");
}
printf("</tr>");
}
?>