Setting mysql count= 3 in html table.. not showing correctly.

you can see my page here http://altadorcup.sketchedneo.com/tester3.php

its suppose to have

Shield
coding
made by
----> x3

example:
Shield Shield Shield
css code css code css code
html code html code html code
direct url direct url direct url

[php]

<?php include ($_SERVER['DOCUMENT_ROOT'].'/header.inc.php'); $sort = mysql_query("SELECT * FROM acshields WHERE checked = 1 ORDER BY id"); $count = 1; while($sort2 = mysql_fetch_array($sort)) { if($count==3){ $graphic_image .= ''; $graphic_code .=''; $graphic_by .= ''; }else{ $count = $count+1 ; } $graphic_image .= " "; $graphic_code .= "CSS Code:
#userinfo .contentModuleContent { background-image: url(\"$sort2[url]\"); background-repeat: no-repeat; background-position: top right; } #userinfo .medText img { visibility: hidden; } #userinfo .medText table table img { visibility: visible; }

HTML Code:

URL:
$sort2[url]

"; $graphic_by .= "$sort2[name] || Made by: $sort2[madeby]"; } ?> <?=$graphic_image?><?=$graphic_code?><?=$graphic_by?>
[/php]

This is my current coding.

Hi,

Here you add rows ( not cells )
[php]
if($count==3){
$graphic_image .= ‘

’;
$graphic_code .=’’;
$graphic_by .= ‘’;
}else{
$count = $count+1 ;
}
[/php]

And here you add rows again
[php]

<?=$graphic_image?><?=$graphic_code?><?=$graphic_by?>
[/php]

Sorry, but the site you posted generates a lot of noise and I’m not going to dig through all kinds of non-relevant information for this problem. I hope you understand.
I’d say try catching just the output of what you have posted above and see if it spits out what you expected.

<table>
  <tr> <!-- A row, every row is a vertical step -->
    <td><!-- A cell, every cell is a horizontal step --></td><td></td><td></td>
  </tr>
  <tr>
    <td></td><td></td><td></td>
  </tr>
  <tr>
    <td></td><td></td><td></td>
  </tr>
</table>

Good luck, :wink:
O.

If I remove

[php]

<?=$graphic_image?><?=$graphic_code?><?=$graphic_by?>
[/php]

from bottom the page is showing blank?

Maybe look here http://altadorcup.sketchedneo.com/tester4.php (this with out count)

[php]

<?php include ($_SERVER['DOCUMENT_ROOT'].'/header.inc.php'); $sort = mysql_query("SELECT * FROM acshields WHERE checked = 1 ORDER BY id"); while($sort2 = mysql_fetch_array($sort)) { $graphic_image .= " "; $graphic_code .= "CSS Code:
#userinfo .contentModuleContent { background-image: url(\"$sort2[url]\"); background-repeat: no-repeat; background-position: top right; } #userinfo .medText img { visibility: hidden; } #userinfo .medText table table img { visibility: visible; }

HTML Code:

URL:
$sort2[url]

"; $graphic_by .= "$sort2[name] || Made by: $sort2[madeby]"; } ?> <?=$graphic_image?><?=$graphic_code?><?=$graphic_by?>
[/php]

I have taken out the site layout from http://altadorcup.sketchedneo.com/tester4.php

so now it just shows relevant information

Looks like you posted the same question twice… I replied to the other one ;D

ANyway, try using the modulus operator… cleaner and less code:

[php]$total = 9; // total from your database results or whatever

echo ‘

’;

for ($i = 1; $i <= $total; $i++) {
if ($i % 3 == 1) {
echo ‘

’;
} else if ($i % 3 == 2) {
echo ‘’;
} else {
echo ‘’;
}
}[/php]
’ . $i . ‘’ . $i . ‘’ . $i . ‘

Sorry I’m so unclear ;D

is it working now?
O.

Sorry, I made a double topic… Can you check here http://www.phphelp.com/forum/index.php?topic=16820.0 I am still stuck

Sponsor our Newsletter | Privacy Policy | Terms of Service