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.

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.