Jump to content

[SOLVED] Missing a simple line for my table results, but I don't know what it is...


JTapp

Recommended Posts

Problem is my data is being returned into to separate tables instead of one table..  can somebody help me correct my mistake?

 

Here is the table code just below my query:

 

$result = mysql_query($query) or die(mysql_error());
while ( $row = mysql_fetch_array($result)) {

echo "<table>";
echo '<table width="65%" border="2" bgcolor=\"#EBECE4\">';
echo '<td>Heading One</td>';
echo '<td><p>Heading Two</p>';
echo '<td><p>Heading Three</p>';
echo '<td><p>Heading Four</p>';
echo '<td><p>Heading Five</p>';
echo "<tr><td>". $row['fieldOne'] . "</td><td>" . $row['fieldTwo'] . "</td><td>" . $row['fieldThree'] . "</td><td>" . $row['fieldFour'] . "</td><td>" . $row['fieldFive'] . "</td></tr>";
echo "</table>";
}

Try (edited slighty):

<?php
$result = mysql_query($query) or die(mysql_error());
echo "<table>";
while ( $row = mysql_fetch_array($result)) {
     echo "<table width=\"65%\" border=\"2\" bgcolor=\"#EBECE4\">";
     echo "<tr><td>Heading One</td><td>Heading Two</td><td>Heading Three</td><td>Heading Four</td><td>Heading Five</td></tr>";
     echo "<tr><td>". $row['fieldOne'] . "</td><td>" . $row['fieldTwo'] . "</td><td>" . $row['fieldThree'] . "</td><td>" . $row['fieldFour'] . "</td><td>" . $row['fieldFive'] . "</td></tr>";
     echo "</table>";
}
echo "</table>";
?>

<?php
$result = mysql_query($query) or die(mysql_error());
echo "<table width=\"65%\" border=\"2\" bgcolor=\"#EBECE4\">";
while ( $row = mysql_fetch_array($result)) {
     echo "<tr><td>Heading One</td><td>Heading Two</td><td>Heading Three</td><td>Heading Four</td><td>Heading Five</td></tr>";
     echo "<tr><td>". $row['fieldOne'] . "</td><td>" . $row['fieldTwo'] . "</td><td>" . $row['fieldThree'] . "</td><td>" . $row['fieldFour'] . "</td><td>" . $row['fieldFive'] . "</td></tr>";
}
echo "</table>";
?>

<?php
$result = mysql_query($query) or die(mysql_error());
echo "<table width=\"65%\" border=\"2\" bgcolor=\"#EBECE4\">";
echo "<tr><td>Heading One</td><td>Heading Two</td><td>Heading Three</td><td>Heading Four</td><td>Heading Five</td></tr>";
while ( $row = mysql_fetch_array($result)) {
     echo "<tr><td>". $row['fieldOne'] . "</td><td>" . $row['fieldTwo'] . "</td><td>" . $row['fieldThree'] . "</td><td>" . $row['fieldFour'] . "</td><td>" . $row['fieldFive'] . "</td></tr>";
}
echo "</table>";
?>

I should read the php more thoroughly.

<?php
$result = mysql_query($query) or die(mysql_error());
echo "<table width=\"65%\" border=\"2\" bgcolor=\"#EBECE4\">";
echo "<tr><td>Heading One</td><td>Heading Two</td><td>Heading Three</td><td>Heading Four</td><td>Heading Five</td></tr>";
while ( $row = mysql_fetch_array($result)) {
     echo "<tr><td>". $row['fieldOne'] . "</td><td>" . $row['fieldTwo'] . "</td><td>" . $row['fieldThree'] . "</td><td>" . $row['fieldFour'] . "</td><td>" . $row['fieldFive'] . "</td></tr>";
}
echo "</table>";
?>

I should read the php more thoroughly.

Ditto lol

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.