husnamina
08-23-2006, 08:29 PM
HI ALL
well am trying to display the result from the sql query that joins two tables. I tested the query it works fine in mysql and give me the required row but when i come to display it only the heading is displayed and NO ERROR MESSAGES WHAT SO EVER.
$sql="select topics.topic_title, topics.mod_id as mt, topics.topic_creator, topics.topic_role,topics.topic_details, topics.post_timestamp as pt,posts.post_title, posts.mod_id as mp, posts.post_creator, posts.post_role,posts.post_details, posts.post_timestamp as pp
from topics inner join posts on topics.topic_id=posts.topic_id where topics.mod_id='$mod' and topics.post_timestamp between '$start' and '$end'" ;
#executing the query2
$result=mysql_query($sql,$myConn) or die("cannot run query <br>$sql").mysql_error();
#if successfull display output
if ($result){
#displaying the table heading.
$list="<table border=\"1\" cellpadding=\"2\" align=\"center\">";
$list .= "<tr style=\" background-color:#6A006A\"><th align=\"center\" style=\" font-style:normal; color:#FFDFFF\">Article Topic</th>";
$list .= "<th style=\" font-style:normal; color:#FFDFFF\">Article Content</th>";
$list .= "<th style=\" font-style:normal; color:#FFDFFF\">Module</th>";
$list .= "<th style=\" font-style:normal; color:#FFDFFF\">Posted By </th>";
$list .= "<th style=\" font-style:normal; color:#FFDFFF\">Role</th>";
$list .= "<th style=\" font-style:normal; color:#FFDFFF\">Date</th>";
$list .="</tr>";
while ($row=mysql_fetch_array($result)) {# displaying table records in a loop
$list .= "<tr>";
$list .="<td>". $row['topic_title']."</td>";
$list .="<td>". $row['topic_details']."</td>";
$list .= "<td>". $row['mt']."</td>";
$list .="<td>".$row['topic_creator']."</td>";
$list .="<td>".$row['topic_role']."</td>";
$list .="<td>" .$row['pt']."</td>";
$list .= "</tr>";
$list .="<tr><td>Replies</td></tr>";
$list .= "<tr>";
$list .="<td>". $row['post_title']."</td>";
$list .="<td>". $row['post_details']."</td>";
$list .= "<td>". $row['mp']."</td>";
$list .= "<td>". $row['post_creator']."</td>";
$list .="<td>".$row['post_role']."</td>";
$list .="<td>" .$row['pp']."</td>";
$list .= "</tr>";
}
mysql_free_result($result);
$list .= "</table>";
Any help will be welcomed. :confused: :(
well am trying to display the result from the sql query that joins two tables. I tested the query it works fine in mysql and give me the required row but when i come to display it only the heading is displayed and NO ERROR MESSAGES WHAT SO EVER.
$sql="select topics.topic_title, topics.mod_id as mt, topics.topic_creator, topics.topic_role,topics.topic_details, topics.post_timestamp as pt,posts.post_title, posts.mod_id as mp, posts.post_creator, posts.post_role,posts.post_details, posts.post_timestamp as pp
from topics inner join posts on topics.topic_id=posts.topic_id where topics.mod_id='$mod' and topics.post_timestamp between '$start' and '$end'" ;
#executing the query2
$result=mysql_query($sql,$myConn) or die("cannot run query <br>$sql").mysql_error();
#if successfull display output
if ($result){
#displaying the table heading.
$list="<table border=\"1\" cellpadding=\"2\" align=\"center\">";
$list .= "<tr style=\" background-color:#6A006A\"><th align=\"center\" style=\" font-style:normal; color:#FFDFFF\">Article Topic</th>";
$list .= "<th style=\" font-style:normal; color:#FFDFFF\">Article Content</th>";
$list .= "<th style=\" font-style:normal; color:#FFDFFF\">Module</th>";
$list .= "<th style=\" font-style:normal; color:#FFDFFF\">Posted By </th>";
$list .= "<th style=\" font-style:normal; color:#FFDFFF\">Role</th>";
$list .= "<th style=\" font-style:normal; color:#FFDFFF\">Date</th>";
$list .="</tr>";
while ($row=mysql_fetch_array($result)) {# displaying table records in a loop
$list .= "<tr>";
$list .="<td>". $row['topic_title']."</td>";
$list .="<td>". $row['topic_details']."</td>";
$list .= "<td>". $row['mt']."</td>";
$list .="<td>".$row['topic_creator']."</td>";
$list .="<td>".$row['topic_role']."</td>";
$list .="<td>" .$row['pt']."</td>";
$list .= "</tr>";
$list .="<tr><td>Replies</td></tr>";
$list .= "<tr>";
$list .="<td>". $row['post_title']."</td>";
$list .="<td>". $row['post_details']."</td>";
$list .= "<td>". $row['mp']."</td>";
$list .= "<td>". $row['post_creator']."</td>";
$list .="<td>".$row['post_role']."</td>";
$list .="<td>" .$row['pp']."</td>";
$list .= "</tr>";
}
mysql_free_result($result);
$list .= "</table>";
Any help will be welcomed. :confused: :(