Jump to content

Getting data from a different table and comparing?


Andy82

Recommended Posts

Hey,

 

I am trying to build a function for lastest entries.

 

I have...

function new_stuff() {
global $prefix, $options;
$new_stuff = get_cache('new_stuff');
if (!$new_stuff) {
	$new_stuff_query = mysql_query("SELECT title, contentid, FROM ". $prefix ."content WHERE status = '1' ORDER BY dateadded DESC, contentid DESC LIMIT ". $options['max_new_stuff']) or die (mysql_error());

$counter = '0';
$new_stuff = array();
while ($new_stuff_row = mysql_fetch_assoc($new_stuff_query_query)) {
$counter++;
$new_stuff[] = array (
'id' => $new_stuff_row['contentid'],
'title' =>	$new_stuff_row['title'],
'counter'	=> $counter
);
}
// Write cache file
write_cache('new_stuff', $new_stuff);
}
return $new_stuff;
}

 

This works fine, the problem I am having is with content sections. I have a section id in my content table e.g

 

Content table

 

title

contentid

sectionid

 

Sections

 

sectionid

section

 

How do I display the sectionid in the content table to display as the section text in the sections table?

 

Thank you for any help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.