Jump to content

Simple mysql_query Table Join help needed


shortysbest

Recommended Posts

I have two mysql tables, one is called "posts", the other is called "removed_posts", I have joined them together and can get some of the information from the tables, but I want to be able to get all of the information.

 

This is my query, and the variables I need the information to go to:

 

$quer = mysql_query("SELECT posts.id, removed_posts.post_id FROM posts, removed_posts WHERE posts.id=removed_posts.post_id AND removed_posts.user_id='".$session."'");
while($get_post = mysql_fetch_array($quer))
{
$session = $_COOKIE['id'];
$to_id = $get_post['to_id'];
$from_id = $get_post['from_id'];
$post = linkify(nl2br(htmlentities($get_post['post'])));
$date = time_stamp($get_post['date']);
$id = $get_post['id'];

 

What that's doing is selecting the id from 'posts' table, and selecting the post_id from the 'removed_posts' table (The query checks to make sure posts.id is equal to removed_posts.post_id), it does that just fine, since I defined what information I wanted it to get in the query, however, now I need to get the other information which will come from the 'posts' table.

 

$get_post['to_id'],

$get_post['from_id'],

$get_post['post'], and

$get_post['date']

 

I hope that's not toooooo confusing, any help would be appreciated

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.