3 Replies - 481 Views - Last Post: 13 April 2009 - 11:02 PM Rate Topic: -----

#1 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 428
  • Joined: 10-April 09

some data not fitting

Posted 13 April 2009 - 06:34 PM

Hi, as you can see here: http://www.dangmn.net/hp/test.php

a set of data shows up in the column perfect, but the other two username and data our outside of the column, can someone look at the scripts and tell me whats wrong?

<?php
session_start();

$db = mysql_connect('localhost', 'dangmnne_dangmnx', ''); //fill in host, hostname, hostpass with your own

if (!$db)
  {
  die('Could not connect: ' . mysql_error());
  }


$db_selected = mysql_select_db('dangmnne_test', $db); //fill in DBname with your own

if (!db_selected)
{

die("cant connect");

}

$result = mysql_query("SELECT * FROM members");

print "<div>
<FONT COLOR='#000'><strong>1v1 standings</strong><br><hr>";

while($row = mysql_fetch_array($result))

  {
  print "<FONT COLOR='#000'><strong> user: </strong>" . $row['username'] . "<br></td>";
  print "<FONT COLOR='#000'><strong> record: </strong>" . $row['record'] . "<br></td>";
  print "<FONT COLOR='#000'><strong> replay: </strong>" . $row['replay'] . "<br></td>";
  print "<FONT COLOR='#000'><strong> ranked: </strong>" . $row['ranked'] . "<br></td>";
  print "<FONT COLOR='#000'><strong> points: </strong>" . $row['points'] . "<br><br></td>";
   }
  
print "</div>";

mysql_close($db);

?>

This post has been edited by dangmnx: 13 April 2009 - 06:35 PM


Is This A Good Question/Topic? 0
  • +

Replies To: some data not fitting

#2 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3097
  • View blog
  • Posts: 10,883
  • Joined: 08-August 08

Re: some data not fitting

Posted 13 April 2009 - 06:53 PM

You're closing the table data fields and not opening any new ones. Try something like this:
(not tested)
print "<th>User:</th><th>Record</th><th>Replay</th><th>Ranked</th><th>Points</th><tr>";
while($row = mysql_fetch_array($result))

  {
  print "<td>" . $row['username'] . "</td>";
  print "<td>" . $row['record'] . "</td>";
  print "<td>" . $row['replay'] . "</td>";
  print "<td>" . $row['ranked'] . "</td>";
  print "<td>" . $row['points'] . "</td><tr>";
   }


Was This Post Helpful? 1
  • +
  • -

#3 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 428
  • Joined: 10-April 09

Re: some data not fitting

Posted 13 April 2009 - 07:00 PM

thank you, works perfect now.
Was This Post Helpful? 0
  • +
  • -

#4 Hary  Icon User is offline

  • D.I.C Regular

Reputation: 44
  • View blog
  • Posts: 427
  • Joined: 23-September 08

Re: some data not fitting

Posted 13 April 2009 - 11:02 PM

And to find these kind of errors, use the w3c html validator:
http://validator.w3.org/

Or use the Html Tidy Firefox plugin.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1