redarrow Posted July 24, 2006 Share Posted July 24, 2006 How do i work this out please cheers.There are two database tables here we go.[code]topic << table 1 nameidnametiltedescriptiondatetime[/code][code]member_comments << table 2 nameidnametiltecommentdate // date from form from topictime// time from form from topic[/code]This pull the data from the database with a while loop and assoc statement.This is to show the members topic.[code]$query_topic="SELECT FROM topic WHERE id='".$_GET['id']."' and date='".$_GET['date']."' and time='".$_GET['time]."' ";$result_topic=mysql_query($query_topic);while($record=mysql_fetch_assocc($result_topic){echo "$record['id'] : $record['name'] : $record['date'] : $record['time'] : $record['description'] ";}[/code]this is the bit i dont get i goto get the date and time to match the topic in the comment table to show the comment and topic together cheers.example only[code]$query_comment="SELECT FROM member_comments WHERE id='".$record['id']."' and date='".$record['date']."' and time='".$record['time]."' ";$result_comment=mysql_query($query_topic);while($data=mysql_fetch_assocc($result_comment){echo "$data['id'] : $data['name'] : $data['date'] : $data['time'] : $data['description'] ";}[/code]So heres the full code and i wrote it on here live so i need to konow is this the correct way to get the member_comments to show on the same page as topic cheers.[code]$query_topic="SELECT FROM topic WHERE id='".$_GET['id']."' and date='".$_GET['date']."' and time='".$_GET['time]."' ";$result_topic=mysql_query($query_topic);while($record=mysql_fetch_assocc($result_topic){echo "$record['id'] : $record['name'] : $record['date'] : $record['time'] : $record['description'] ";}$query_comment="SELECT FROM member_comments WHERE id='".$record['id']."' and date='".$record['date']."' and time='".$record['time]."' ";$result_comment=mysql_query($query_topic);while($data=mysql_fetch_assocc($result_comment){echo "$data['id'] : $data['name'] : $data['date'] : $data['time'] : $data['description'] ";}[/code] Link to comment https://forums.phpfreaks.com/topic/15507-need-help-with-select-statement-in-php-to-show-two-select-statements/ Share on other sites More sharing options...
redarrow Posted July 24, 2006 Author Share Posted July 24, 2006 bump am i correct then please help cheers. Link to comment https://forums.phpfreaks.com/topic/15507-need-help-with-select-statement-in-php-to-show-two-select-statements/#findComment-62980 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.