Jump to content

[SOLVED] Grab info from mulitple tables


SkyRanger

Recommended Posts

Ok, I am stuck on something.  Here is the problem I am having.

 

User clicks on link:

 

viewlatest?oid=$oid

 

it reads the table office_posts for latest oid

 

table layouts are as follows:

 

office_posts

oid

omid

omsg

 

users

id

member

 

What I need it to do is read the 2 tables, and display omsg and member name when omid = id

 

Here is what I have so far:

 

$resultopv = mysql_query( "SELECT users.*, office_posts.* ".
"FROM users, office_posts ".
"where oid='$oid' and omid = '$id' ORDER BY `oid` DESC limit 0 , 1") or die(mysql_error());

$wordnum = mysql_num_rows( $resultopv );
while( $rowopv = mysql_fetch_array( $resultopv ) )
{
$latpt = $rowopv['omsg'];
$latmr = $rowopv['member'];
}

 

 

I know there is something wrong with that code, just not sure what it is.

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/48145-solved-grab-info-from-mulitple-tables/
Share on other sites

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.