Skip to main content
Known Participant
June 25, 2009
Answered

How to set two values equal from different recordset?

  • June 25, 2009
  • 1 reply
  • 556 views

I have created a posts recordset and a comments recordset

the comments table has a post_id to link the comment to a specific post through setting it equal to the id field in the posts table

so that whenever a post loads the comment whos post_id is equal to the id of the post should load

I know that if one advanced recordset combining the two tables is created I can set the values to be eqal in the where clause but doing so causes an error in the url parameters of the page.

Plz help guys and thanks in advance.

This topic has been closed for replies.
Correct answer

Just do this in advanced recordset

SELECT *

FROM posts JOIN comment

ON posts.post_id = comment.post_id

WHERE posts.post_id = colname

Add 1 variable

name: colname

type: numeric

default value: -1

runtime value: $_GET['pid']

so in browser URL it will be post_view.php?pid=1

1 reply

Correct answer
June 26, 2009

Just do this in advanced recordset

SELECT *

FROM posts JOIN comment

ON posts.post_id = comment.post_id

WHERE posts.post_id = colname

Add 1 variable

name: colname

type: numeric

default value: -1

runtime value: $_GET['pid']

so in browser URL it will be post_view.php?pid=1

adi3199Author
Known Participant
June 26, 2009

Well Thanks for the quick reply but dreamweaver shows an error saying that "comments.post_id does not exist in ON clause"

adi3199Author
Known Participant
June 26, 2009

ok it works thanks a lot its just that the row wasn't comments.post_id it was comments.posts_id.

Thanks a lot Dear.