Multiple Tables

<html>
<head>
<title>Test</title>
</head>

<body>
<?php
include("connection.php");


mysql_select_db('database1');

$retrieve = mysql_query("SELECT * FROM table_in_database1");


echo"<table width='100%' border='1'>";
echo"<tr><th>First Name</th><th>Last Name</th><th>Address</th><th>City</th><th>State</th><th>Zip Code</th><th>Phone</th><th>Email</th><th>Total Attending including Registeree</th><th>Names of Attendees</th><th>Number of Adults</th><th>Number of Children</th><th>Ages of Children</th><th>Fees Waived</th><th>Items Purchased</th><th>Date Paid</th></tr>";

while ($rows=mysql_fetch_assoc($retrieve)){
echo "<tr><td><center>{$rows['FirstName']}</center></td>";
echo "<td><center>{$rows['LastName']}</center></td>";
echo "<td><center>{$rows['Address']}</center></td>";
echo "<td><center>{$rows['City']}</center></td>";

echo "<td><center>{$rows['State']}</center></td>";

echo "<td><center>{$rows['ZipCode']}</center></td>";

echo "<td><center>{$rows['Phone']}</center></td>";

echo "<td><center>{$rows['Email']}</center></td>";

echo "<td><center>{$rows['TotalAttending']}</center></td>";

echo "<td><center>{$rows['otherAttendees']}</center></td>";

echo "<td><center>{$rows['numberOfAdults']}</center></td>";

echo "<td><center>{$rows['numberOfChildren']}</center></td>";

echo "<td><center>{$rows['agesOfChildren']}</center></td>";

echo "<td><center>{$rows['Waived']}</center></td>";

}

mysql_select_db('database2');

$retrieve=mysql_query("SELECT * FROM table_in_database2");

while ($rows=mysql_fetch_assoc($retrieve)){
	echo "<td><center>{$rows['activity']}</center></td>";
	echo "<td><center>{$rows['paymentdate']}</center></td></tr>";

}
echo "</table>";
mysql_close($connection);


?>

</body>
</html>

The problem I’m having is the data I’m receiving from table_in_database2 is not meshing in the HTML table with table_in_database1.

[table]
[tr]
[td]This[/td][td]is[/td][td]problem1[/td][td].[/td][/tr][/table]
[table][tr][td]This[/td][td]is[/td][td]problem2[/td][td].[/td][/tr][/table]
[table][tr][td]This[/td][td]is[/td][td]problem3[/td][td].[/td][/tr][/table]
[table][tr][td]This[/td][td]is[/td][td]problem4[/td][td].[/td]
[td]Here[/td][td]lies[/td][td]issue1.[/td]
[/tr][/table]
[table][tr][td]Here[/td][td]lies[/td][td]issue2.[/td][/tr][/table]
[table][tr][td]Here[/td][td]lies[/td][td]issue3.[/td][/tr][/table]
[table][tr][td]Here[/td][td]lies[/td][td]issue4.[/td][/tr]
[/table]

“Here lies the issue1.”

I would rather have with

“This is problem1 .”

Anything inside of a loop means it repeats that code numerous times. Check your loops. Make sure the code you want repeated is correct.

Thanks…there were a few issues…but definitely adjusting my loop helped.

Issue resolved.

Sponsor our Newsletter | Privacy Policy | Terms of Service