You have forgotten one table in your second query, try this :
$eventdetails_query = mysql_query("select details, information, file_name from event, eventdetails where event.id = eventdetails.event_id");
Karl-Heinz Schulz wrote:
Thank you for the information but I still have some problems.
I use the following code
<code>
<?php require("../admin/functions.php");
include("../admin/header.inc.php");
?> <? $event_query = mysql_query("select id, inserted, information, eventname, date, title from event order by inserted desc LIMIT 0 , 30"); while($event = mysql_fetch_row($event_query)){
print("<b><span style=\"font-family: Arial, Helvetica,
sans-serif;color:#003300;font-size:14px;\">".html_decode($event[5])."</span>
</b><br>");
print("<span style=\"font-family: Arial, Helvetica,
sans-serif;font-size:12px;\">".html_decode($event[4])."</span><br>");
print("<span style=\"font-family: Arial, Helvetica,
sans-serif;font-size:12px;\">".html_decode($event[2])."</span><p>");
}
?>
<? $eventdetails_query = mysql_query("select details, information, file_name
from eventdetails where event.id = eventdetails.event_id");
while($eventdetails = mysql_fetch_row($eventdetails_query)){
print("<span style=\"font-family: Arial, Helvetica,
sans-serif;font-size:12px;\">".html_decode($eventdetails[0])."</span><p>");
print("<span style=\"font-family: Arial, Helvetica,
sans-serif;font-size:12px;\">".html_decode($eventdetails[1])."</span><p>");
print("<span style=\"font-family: Arial, Helvetica,
sans-serif;font-size:12px;\">".html_decode($eventdetails[2])."</span><p>");
} ?>
</code>
But it generates now for the second query the "is not a valid MySql result" error.
TIA
-----Original Message-----
From: zareef ahmed [mailto:[EMAIL PROTECTED] Sent: Thursday, July 29, 2004 11:57 PM
To: Karl-Heinz Schulz; [EMAIL PROTECTED]
Subject: Re: [PHP] How to nest information from different tables.
Hi,
You can use join or make this query as follows
$query="select *(or coulmn name) from event, eventdetails where event.id = eventdetails.id";
zareef ahmed
--- Karl-Heinz Schulz <[EMAIL PROTECTED]> wrote:
I have two tables with relevant information's;
Table1 -> event Table 2 -> eventdetails
I'm trying to list all events in table one plus to show for each event whatever documents are available (file_name, information)
My code to list all events from the "event" table is:
<code>
<?php require("../admin/functions.php");
include("../admin/header.inc.php");
?> <? $event_query = mysql_query("select id, inserted, information, eventname, date, title from event order by inserted desc LIMIT 0 , 30"); while($event = mysql_fetch_row($event_query)){
print("<b><span style=\"font-family: Arial, Helvetica,
sans-serif;color:#003300;font-size:14px;\">".html_decode($event[5])."</span>
</b><br>"); print("<span style=\"font-family: Arial, Helvetica,
sans-serif;font-size:12px;\">".html_decode($event[4])."</span><br>");
print("<span style=\"font-family: Arial, Helvetica,
sans-serif;font-size:12px;\">".html_decode($event[2])."</span><hr><p>");
print ( here I would need the list of all files associates with the event " $eventdetails_query = mysql_query("select filename, information from eventdetails where event=".$id);"
} ?>
</code>
Can this be done and what would be the best approach?
TIA
Karl-Heinz
Tracking #: A3E9B485BFDA4A44A6BFCE20A805CA39C3D820DA
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
===== Zareef Ahmed :: A PHP Developer in Delhi(India). Homepage :: http://www.zasaifi.com
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php