try to change with this:
if(ISSET($category)){
$columns = 3;
$count = 0;
$viewsql = "select * from $tbn2 where catid = \"$category\" ";
$viewres = @mysql_query($viewsql, $con) or die ("Cant get details.
Please report this to the website administrator");
$num_rows = mysql_num_rows($viewres);
while( $v1rows = mysql_fetch_array($viewres) ){
$name2 = $v1rows[name];
$id2 = $v1rows[catid];
$simg = $v1rows[smallimg];
if ($count == $columns)
{
$count = 0;
$v1list .="<tr><td>$name2</br><a href
=\"./viewdetails.php?pcategory=$id2&pname=$name2\"><img src=$simg
border=0></a></td>";
}
else if ($count < $columns)
{
$count++;
$v1list .="<td>$name2</br><a href
=\"./viewdetails.php?pcategory=$id2&pname=$name2\"><img src=$simg
border=0></a></td>";
}
}
//close row
for ($i=$count;$i<=$columns;$i++)
{
$v1list .="<td> </td>";
}
$v1list .= "</tr>";
}
Bye Moreno
-----Messaggio originale-----
Da: Dave Carrera [mailto:[EMAIL PROTECTED]]
Inviato: lunedi 18 febbraio 2002 15.51
A: php List
Oggetto: [PHP-DB] RE: I cant get the logic for this...
Firstly thanks to everyone who have supplied various way to implement
the issue I was having.
Unfortunately I cant seem to get any one of them to function correctly
I have included my code to see if someone can help adjusting it.
I think I am going wrong in where I am putting the count var.
You may notice I am using the var $v1list. this is so I can display the
output in suitable place on screen.
The code I have included makes my 7 selected items go straight across
the page(obviously) hence the need to
Block it of with some kind of count function.
Thank you for any help or advice
Dave C
------------CODE HERE------------------
if(ISSET($category)){
$viewsql = "select * from $tbn2 where catid = \"$category\" ";
$viewres = @mysql_query($viewsql, $con) or die ("Cant get details.
Please report this to the website administrator");
$num_rows = mysql_num_rows($viewres);
while( $v1rows = mysql_fetch_array($viewres) ){
$name2 = $v1rows[name];
$id2 = $v1rows[catid];
$simg = $v1rows[smallimg];
$v1list .="<td>$name2</br><a href
=\"./viewdetails.php?pcategory=$id2&pname=$name2\"><img src=$simg
border=0></a></td>";
}
}
Dave Carrera
Php / MySql Development
Web Design
Site Marketing
http://www.davecarrera.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php