Jump to content


Photo

Need help with select statement in php to show two select statements.


  • Please log in to reply
1 reply to this topic

#1 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 24 July 2006 - 04:21 PM

How do i work this out please cheers.

There are two database tables here we go.
topic << table 1 name
id
name
tilte
description
date
time

member_comments << table 2 name
id
name
tilte
comment
date // date from form from topic
time// time from form from topic

This pull the data from the database with a while loop and assoc statement.

This is to show the members topic.
$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'] ";

}

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
$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'] ";

}


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.


$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'] ";

}


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 24 July 2006 - 04:50 PM

bump am i correct then please help cheers.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users