Reply
Showing data from two tables...
Old 04-18-2003, 11:24 PM Showing data from two tables...
Mankiy's Avatar
Skilled Talker

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 &nbsp;&nbsp;&nbsp;&nbsp; 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 &nbsp;&nbsp;&nbsp;&nbsp; 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 :) )
Mankiy is offline
Reply With Quote
View Public Profile Visit Mankiy's homepage!
 
When You Register, These Ads Go Away!
Old 04-19-2003, 05:44 AM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Are you even connected to the server and have you selected a database or is that config.php?


<rant>
What kind of errors are you getting?!? Details, details, details!
We can't read minds so please try and be more descriptive. It just seems a bit lazy to not provide someone that is helping you with a full description. </rant>
-dk
__________________
Did I help you? If so, be nice and throw me some TP
dk01 is offline
Reply With Quote
View Public Profile Visit dk01's homepage!
 
Old 04-19-2003, 12:14 PM
Mankiy's Avatar
Skilled Talker

Posts: 73
Location: The Light and The Dark, a Renegade at Heart
config.php connects to the db for me, and im notg etting errors, its jsut now showing the info.

I got everything right on the coede and all too....
__________________
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 :) )
Mankiy is offline
Reply With Quote
View Public Profile Visit Mankiy's homepage!
 
Reply     « Reply to Showing data from two tables...
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12834 seconds with 12 queries