how can i thumbnail data in php
Moderator: General Moderators
-
manojsemwal1
- Forum Contributor
- Posts: 217
- Joined: Mon Jun 29, 2009 4:13 am
- Location: India
how can i thumbnail data in php
hello friend can somebody tell me how can i print data in rows wise ..like
my data is print like..
1
2
3
4
5
6
but i want
1 2 3 4 5 6 7
8 9 10 11 12 13
14,...
means after some restriction it will be break....
manoj
my data is print like..
1
2
3
4
5
6
but i want
1 2 3 4 5 6 7
8 9 10 11 12 13
14,...
means after some restriction it will be break....
manoj
Re: how can i thumbnail data in php
You could do it with a loop and some if statements but that's a lot of work.
For example if $i is greater than or equal to 6 then start a new line.
Do it with CSS in my opinion.
For example if $i is greater than or equal to 6 then start a new line.
Do it with CSS in my opinion.
-
manojsemwal1
- Forum Contributor
- Posts: 217
- Joined: Mon Jun 29, 2009 4:13 am
- Location: India
Re: how can i thumbnail data in php
Thanks for quick reply...
pl can u send me the css file for that...
regards,
manoj
pl can u send me the css file for that...
regards,
manoj
Re: how can i thumbnail data in php
Why can't you write it yourself?
Re: how can i thumbnail data in php
It's simple:You could do it with a loop and some if statements but that's a lot of work.
Code: Select all
<?php
$numbers = range(1,100);
foreach($numbers as $number){
echo $number . ' ';
if($number%5 == 0){
echo '<br />';
}
}
Code: Select all
<?php
$numbers = range(1,100);
foreach($numbers as $number){
echo $number . ' ';
if($number%10 == 0){
echo '<br />';
}
}
-
manojsemwal1
- Forum Contributor
- Posts: 217
- Joined: Mon Jun 29, 2009 4:13 am
- Location: India
Re: how can i thumbnail data in php
i Had tried your example is working fine but while printing form database its not print properly...
<?php
$sql = "select CourseId, CourseAbbr from coursetb";
$rs = mysql_query($sql) or die(mysql_errormsg());
$count=mysql_num_rows($rs);
$n=0;
$i = 1;
while ($n < $count )
{
$courseId = mysql_result($rs,$n,0);
$course = mysql_result($rs,$n,1);
$numbers = range(1,$count);
echo $number;
foreach($numbers as $number)
{
echo"<input type = checkbox name=courseid[] value=$courseId > $course ";
if($number%5 == 0)
{
echo '<br />';
}
}
$n++;
}
?>
here iam trying to print Course Name. After Reach 5 course in a line it should be break and print next line...
thanks
<?php
$sql = "select CourseId, CourseAbbr from coursetb";
$rs = mysql_query($sql) or die(mysql_errormsg());
$count=mysql_num_rows($rs);
$n=0;
$i = 1;
while ($n < $count )
{
$courseId = mysql_result($rs,$n,0);
$course = mysql_result($rs,$n,1);
$numbers = range(1,$count);
echo $number;
foreach($numbers as $number)
{
echo"<input type = checkbox name=courseid[] value=$courseId > $course ";
if($number%5 == 0)
{
echo '<br />';
}
}
$n++;
}
?>
here iam trying to print Course Name. After Reach 5 course in a line it should be break and print next line...
thanks
Re: how can i thumbnail data in php
The solution for you:
Code: Select all
<?php
$query = 'SELECT CourseId, CourseAbbr FROM coursetb';
$result = mysql_query($query);
$n = 1;
while ($row = mysql_fetch_assoc($result)) {
echo '<input type="checkbox" name="courseid[]" value="'.$row['CourseId'].'" > '. $row['CourseAbbr'] .' ';
if($n%5 == 0){
echo '<br />';
}
$n++;
}
-
manojsemwal1
- Forum Contributor
- Posts: 217
- Joined: Mon Jun 29, 2009 4:13 am
- Location: India
Re: how can i thumbnail data in php
Thanks Budy.....
Thank u Very Much ........
regards,
Thank u Very Much ........
regards,