FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


erratic behavior in my php scripts





ammonkc
I can't figure out what is going on here with my php script. This one has got me stumped. I pull a result set from a mysql table and display that set via a while loop. I'm using a CSS and divs to display the list instead of tables. The problem is that I get a row that is thrown way off out side of my layout with missing data everyonce in a while. It only seems to happen in FireFox(the most updated version) and it doesn't happen all the time. If I press refresh then it displays fine. everyonce in a while though I just get a row that doesn't render properly at all. If I "view source" the html all looks correct and I can't find anything that would cause this erratic behavior. and the fact that when I refresh the page it corrects the problem would confirm that its not a problem with the markup.

here is my code:

Code:

while ($row = mysql_fetch_array($result,MYSQL_ASSOC)){//changed to
   $user_rows .= '<div id="user-row"><a href="index.php?action=accounts&task=view&user_id='.$row['user_id'].'">';
   $user_rows .= '<div class="col1">'.trim($row['user_company']).'</div>';
   $user_rows .= '<div class="col2">'.trim($row['user_first']).'&nbsp;'.trim($row['user_last']).'</div>';
   $user_rows .= '<div class="col3">'.trim($row['user_email']).'</div>';
   $user_rows .= '</a></div><div id="spacer">&nbsp;</div>';
}//end while loop
echo <<<END
<div id="user-box">
   <h1 style="border:1px solid #ccc;padding:0.3em;text-align:center;">Active Users</h1>
   <div id="user-header">
      <div class="col1">Company</div>
      <div class="col2">Name</div>
      <div class="col3">Email</div>
   </div><div id="spacer">&nbsp;</div><div id="spacer">&nbsp;</div>
   $user_rows
</div>
<div id="user-footer">$next_prev</div>
END;


Here is the CSS:
Code:

#user-box {
   margin:0 auto;
   width:500px;
   margin-left:2em;
}
div#user-header {
   position:absolute;
   margin:0 auto;
   width:500px;
   line-height:1.2em;
   font-weight:bold;
   font-size:1.5em;
   color:#333;
   background:#ccc;
   clear:right;
}
div#user-header div.col1,div#user-header div.col2,div#user-header div.col3 {
   width:32%;
   height:1.5em;
   text-align:center;
   float:left;
   overflow:hidden;
}
#user-footer {
   margin:0 auto;
   text-align:center;
}
div#user-row {
   width:500px;
   height:1.1em;
   position:absolute;
   line-height:1.1em;
   background:#eee;
   margin:0 auto;
}
div#user-row div.col1,div#user-row div.col2,div#user-row div.col3 {
   width:145px;
   max-width:145px;
   height:1.1em;
   text-align:center;
   margin-right:2px;
   margin-bottom:5px;
   float:left;
   border-right:1px solid #666;
   overflow:hidden;
}
div#user-row div.col3 {
   border:0;
   width:200px;
   max-width:200px;
}
div#user-row a {
   width:500px;
   max-width:520px;
   height:1.1em;
   margin:0 auto;
   position:absolute;
   border:1px solid #0d2474;
   color:#0d2474;
   line-height:1.1em;
   background:#fff;
   text-decoration:none;
}
#user-row a:hover {
   border:1px solid #666;
   color:#000;
   background:#f1f1f1;
}
garionw
Use tables, thats what they're made for. Rolling Eyes
Related topics
[php scripts ] phpweather&email
How To : Improve Your PHP Programming
Mod's Installed and Custom PHP Scripts Made
Mod's Installed and Custom PHP Scripts Made
Tutorial: PHP Installed Modules Dynamic Reference Tool
Phoenix free PHP scripts
Using PHP
[SOLVED] PHP is not working
Install PHPBB-10$ SMF-5$ MediaWiki-10$ & other Scripts
PHP Question
need php scripts installed - 120 Frih$'s
PHP scripts
PHP scripts not functioning.
know how much memory are your php scripts using
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.