Jump to content

[SOLVED] Making tables with sql data.


$username

Recommended Posts

Hello Ladies and Gents,

    I have a new issue.

 

I have a piece of code that throws my tables off.

 

while($row = mysql_fetch_array($query)) {
echo "<tr>";
echo("<td><a href=\"updateinfo.php?ID=" .  $row["ID"] . "\" title=\"".$row["ID"]."\">" . $row["ID"] .  "</a><td>"); 
echo "<td>".$row['FirstName']."</td>";
echo "<td>".$row['LastName']."</td>";
echo "<td>".$row['AddressStreet']."</td>";
echo "<td>".$row['AddressCity']."</td>";
echo "<td>".$row['AddressState']."</td>";
echo "<td>".$row['AddressZip']."</td>";
echo "<td>".$row['Paid']."</td>";
echo "<td>".$row['Amount']."</td>";
echo "<td>".$row['CaseNotes1']."</td>";
echo "<td>".$row['CaseNotes2']."</td>";
echo "<td>".$row['CaseNotes3']."</td>";
echo "<td>".$row['CaseNotes4']."</td>";
echo "<td>".$row['OtherInfo']."</td>";
echo "<td>".$row['ServBy']."</td>";
echo "<td>".$row['ClientName']."</td>";
echo "<td>".$row['County']."</td>";
echo "<td>".$row['ServDate']."</td>";
echo "</tr>";
}

?>

 

When I take out the link generator on the second line, then my tables line up. When the 3 lines is in there is throws everything off.

 

echo("<td><a href=\"updateinfo.php?ID=" .  $row["ID"] . "\" title=\"".$row["ID"]."\">" . $row["ID"] .  "</a><td>"); 

 

Here is a pic of what it looks like.

 

tabbleoff.JPG

 

When I don't have that code in there it looks like this.

 

echo "<td>".$row['ID']."</td>";

 

tablesoff2.JPG

 

Is there something I can do that would make the code work with in one table.

 

Thanks,

Brett

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/59138-solved-making-tables-with-sql-data/
Share on other sites

Beat to it :P

 

Your not closing the <td>

 

Change:

echo("<td><a href=\"updateinfo.php?ID=" .  $row["ID"] . "\" title=\"".$row["ID"]."\">" . $row["ID"] .  "</a><td>"); 

 

To:

echo("<td><a href=\"updateinfo.php?ID=" .  $row["ID"] . "\" title=\"".$row["ID"]."\">" . $row["ID"] .  "</a></td>"); 

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.