how do i get the table inside?

bare with me here because I will try and word this best I know how.

I have managed to pull the date from my vbulletin forum and show members online on the site homepage, which by the way vbulletin said cant be done???  but I did it.
Anyhow I place code outside the site but then I have issues with width, I choose 80% it looks great but when I check with another browser size its to long then I ajust and you get the picture.
size and % never seems to work, if I can just get it into my frames it would look fine.

here is a section of my code i am having trouble with.
this code at the moment has the members online outside the site frames.
I just cant seem to get it inside without screwing the design up.
remember the code is all fine, i just need to get the sql echo inside the frame so i dont need to worry about the size of that section.


</tr>
 
			</table>';
			
	
				
			
				echo '</td>
			</tr>
		</table>
		</td>
	</tr>
</table>
	
<center>
					</form>
					</td>
				</tr><tr>
					<td class="windowbg3"><center><center> </td>
				</tr
			</table>';
?><center>
<table width="62%" cellspacing="0" cellpadding="0" border="0" class="border"0">
	<tr>
					<td class="windowbg4"><center><b>Active registered members online</b> </td>
	</tr><tr>
					<td class="windowbg3"><center><center><font size="1">Active registered members online in the last 15 minutes</font></center>
					<form action="index.php?action=login&sub=1" method="post">
					<table width="100%" cellspacing="1" cellpadding="10" border="0"> 
					
							<td class="windowbg" colspan="2"><img src="ico/sub7.gif">  <font size="1" color="white">Members Online:</b></font><font size="1" color="#fff000">
 
 
                           <b>  </title></b></font></a>
 
 
 
 
 
<?php
$con = mysql_connect('localhost', '???????', '?????');
mysql_select_db('???????',$con);
 
$t = time() - 7600;
$q = mysql_query("select username FROM user WHERE lastactivity > $t");
 
while ($u = mysql_fetch_array($q))
   echo $u['username'].", ";

Open in new window

SonicM3Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dvz-Commented:
First of all, you're missing a closing '>' for the </tr> tag in the following snippit:

  <td class="windowbg3"><center><center> </td>
                                </tr
                        </table>';


Second of all, I'd recommend, rather than echoing HTML inside of PHP, like that big block of table that you're echoing, break out of PHP and print it as is in HTML.  Meaning, it's better to

<table>
<?php
    //some php code
    while ( $something == 'true' ) {
?>

<tr>
  <td><?php echo $someValue?></td>
 </td>

<?php
    }
?>


And third...You have have a lot of open <center> but no closing </center>.
0
SonicM3Author Commented:
i have corrected points 1 and 3 thanks.

as for point 2 i want to get it into the php because it will take care of all the size problems i have.
what would you suggest to get this code into the php?


<center>
<table width="62%" cellspacing="0" cellpadding="0" border="0" class="border"0">
	<tr>
					<td class="windowbg4"><center><b>Active registered members online</b></center> </td>
	</tr><tr>
					<td class="windowbg3"><center><font size="1">Active registered members online in the last 15 minutes</font></center>
					<form action="index.php?action=login&sub=1" method="post">
					<table width="100%" cellspacing="1" cellpadding="10" border="0"> 	
					 	<td class="windowbg" colspan="2"><img src="ico/sub7.gif">  <font size="1" color="white">Members Online:</b></font><font size="1" color="#91aadf">
                           <b>  </title></b></font></a>
<?php
$con = mysql_connect('localhost', '???', '???');
mysql_select_db('???',$con);
 
$t = time() - 7600;
$q = mysql_query("select username FROM user WHERE lastactivity > $t");
 
while ($u = mysql_fetch_array($q))
   echo $u['username'].", ";

Open in new window

0
SonicM3Author Commented:
and the code above that is as follows.
<tr>	           
                     <td class="windowbg3"><center><a href="http://mysite.com/downloads/dile2.zip"><img src="ico/update.gif" border="0"></a></center></td>
				</tr>
			</table>';
			
				echo '</td>
			</tr>
		</table>
		</td>
	</tr>
</table>
<center>
					</form>
					</td>
				</tr><tr>
					<td class="windowbg3"> </td>
				</tr>
			</table>';
?>

Open in new window

0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

dvz-Commented:
it doesn't matter if the table is printed from php or outside of php - unless you're telling to print the appropriate values, it'll continue to display incorrectly.

printing in php just makes it a headache to read and fix.

you can easily "inject" variables into the HTML code (outside of the php block)...

further, you have this:

<font size="1" color="#91aadf">
                       <b>  </title></b></font></a>
<?php

where's teh opening of the TITLE tag?  i don't think </title> should be there.



Lastly, I would recommend, if possible, to use divs rather than tables...it may make things a lil tougher to get working right in all browsers at first, but it's well worth the changeover.
0
SonicM3Author Commented:
i see what you mean.i will check this out now, and thanks i will report back
0
SonicM3Author Commented:
na am having trouble changing this around, i was wondering if I should load the online members into another webpage and echo it in.
i got so much to sort out and i am behind way to much i was hoping to just drop the lot right in and be done and fix when in its in,
i will have a play about with it.
0
dvz-Commented:
you should be fine the way you have it set up...i'd probably rearrange it and do all the database work up top before printing out the body...but that's just me...

You're php code seems like it should work fine...the code in question seems to be the tables surrounding...

if the changing from tables to divs is too complicated atm, stick with your tables...though I'd still keep the tables outside of php and line them up so you can easily read them...

<table>
  <tr>
    <td></td>
   </tr>
 </table>

that way you can make sure all the necessary tags are matched with each other...

if all the tags match together, then maybe try changing the attributes of the tags such as <table> <tr> etc. to classes rather than inline attributes (i.e. width, borders, etc.)  That way you can create a CSS style sheet for browsers independently...

so <table class="tbl1">  would be able to work with each browser using a different defined style, whereas
<table width="100%" cellpadding="0" border="1"> is static for all browsers.
Some of the browsers may require special mending to get it to work.

Just a suggestion for thought

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SonicM3Author Commented:
thanks mate yer your proberly right for that.
just trying to get the width sorted its always like 1 pixel out each side any ideas what causes this, it JUST never lines up nice with the top site
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.