Posts: 73
Location: The Light and The Dark, a Renegade at Heart
|
I need help with something, in the forums im coding, it wont let me let view data from both tables..........
i want it to view info from the parent table and info from the child table
plz help with this, because i dont even know if its possible
ty ^^
PHP Code:
<?php
include("config.php");
// session start and check
session_start();
$username = $_SESSION["username"];
$password = $_SESSION["password"];
if (empty($username) || empty($password)) {
// session unregister
session_unregister("username");
session_unregister("password");
?>
<SCRIPT language="JavaScript1.1">
<!--
location.replace("http://members.lycos.co.uk/clanx/login.php");
//-->
</SCRIPT>
<?php
}
?>
<html>
<head>
<title> :. Messages v1.3 </title>
</head>
<body bgcolor="#000000" text="#C0C0C0">
<br>
<a href="ex.php">Back</a> |<?php echo("<a href=\"reply.php?ID=$ID\">Reply</a>"); ?>
<br>
<br>
<p><font color="#BB0000"> Message: </font></p>
<?php
// get the first post of the parent table
$result1 = @mysql_query("SELECT * FROM parent WHERE ID='$ID'");
if (!$result1) {
echo("<p>Error getting information:<br> " . mysql_error() . "</p>");
}
// Display the text of each post in the child table
while ( $row1 = mysql_fetch_array(result1) ) {
$posted_by1 = $row1["name"];
$message1 = $row1["post_text"];
$topic1 = $row1["topic"];
$posted_on1 = $row1["date"];
echo("<table width=\"600\"><tr bgcolor=\"#000080\"><td>$topic1</td></tr>
<tr bgcolor=\"#000080\"><td> Posted By: $posted_by1 On: $posted_on1 </td></tr>
<tr><td><br><br> $message1 </td></tr></table>" );
}
?>
<?php
// Request the info of all the msg's
$result = @mysql_query("SELECT * FROM child WHERE parent_ID='$ID'");
if (!$result) {
echo("<p>Error getting information:<br> " . mysql_error() . "</p>");
}
// Display the text of each post in the child table
while ( $row = mysql_fetch_array($result) && $row1 = mysql_fetch_array(result1) ) {
$posted_by = $row["name"];
$message = $row["post_text"];
$topic = $row["topic"];
$posted_on = $row["date"];
echo("<table width=\"600\"><tr bgcolor=\"#000080\"><td>$topic</td></tr>
<tr bgcolor=\"#000080\"><td> Posted By: $posted_by On: $posted_on </td></tr>
<tr><td><br><br> $message </td></tr></table>" );
}
exit();
mysql_close();
?>
</body>
</html>
__________________
New Gaming Site Coming Soon!
Regular accounts are Free, Premium accounts are $5 to start, $2 every month after.....
Will be a Gaming Clan add-on (yeh, i have a gaming clan :) )
|