Jump to content

Recommended Posts

I run a php-Fusion Content Management system on www.community.blackvine-animation.co.uk, and wanted the news from that to be displayed on my main site: www.blackvine-animation.co.uk.

 

I successfully did this yesterday, however, I still need to get the time and date of posting, the username of postee and the link to comment the news at www.community.blackvine-animation.co.uk there.

 

The most important one of these I think is the Username.

There is I think 3 different parts to this. The table fusion_users contains users_id, which is the same as news_name contained in the table fusion_news. user_id decides user_name. I need to make news_name equal user_id then get user_id to equal the correct user_name, but have no idea how, then I need to print this at the bottom of the news post using php. I understand roughly what I'm doing, as I have used PHP and MySQL a little, but I'm still very lost here!

 

Sorry if this is in the wrong section. I've looked for help for this everywhere, and am new to this forum, and you guys all seem to be nice and know what you're doing, so I thought I'd ask here!

 

Thanks

Well to be honest it seems simpler doing it the way I've done it. I'm trying to avoid using third party stuff on the main site, and wanted to code as much of it as I could myself. And learning simpleXML to code this myself is going to be awkward, and I can't find a decent tutorial. What I've done to get the news on www.blackvine-animation.co.uk from www.community.blackvine-animation.co.uk is this:

 

<?php 
	  	include 'config.php';
	include 'opendb.php';
	  $query  = "SELECT news_subject FROM fusion_news ORDER BY news_datestamp DESC LIMIT 0,10";


$result = mysql_query($query);

if($row = mysql_fetch_array($result, MYSQL_ASSOC))


$subjects = nl2br("{$row['news_subject']}<br>" );





echo stripslashes($subjects);

?>
	  
          
           </div>
	   <div id="imageplace"></div>
          
           <p>
	  <?php
	  	include 'config.php';
	include 'opendb.php';




	$query  = "SELECT * FROM fusion_news ORDER BY news_datestamp DESC LIMIT 0,10";


$result = mysql_query($query);

if($row = mysql_fetch_array($result, MYSQL_ASSOC))

$news =  nl2br("{$row['news_news']} <br>") .
         nl2br("{$row['news_extended']} <br><br>");




{
    echo stripslashes($news);


} 

	include 'closedb.php';

	?>
       

 

That just takes the news and subject from the database entry that php-fusion makes when news is entered via the form on there. What I want is to get the user name on there aswell. In the fusion_news table, it identifies the user who made the post by news_name, which is entered as a numeric value.

In the table fusion_users, there is user_name and user_id. User_name is there name in text, user_id is numeric value. I need to make it take the news_name numeric value, then make that equal user_id, then make that find the user_name, but don't know how. Any idea how to do this? Even just pointing me in the right direction as in like a name of a function or something that I can research and learn myself would be great.

In the table fusion_users, there is user_name and user_id. User_name is there name in text, user_id is numeric value. I need to make it take the news_name numeric value, then make that equal user_id, then make that find the user_name, but don't know how. Any idea how to do this? Even just pointing me in the right direction as in like a name of a function or something that I can research and learn myself would be great.

Have a look at the tutorial recently posted on phpFreaks:

http://www.phpfreaks.com/tutorial/data-joins-unions

 

Also, for future reference, SimpleXML is a part of php. It's not 3rd party, and, as the name implies, it's simple.

$rss_file = @file_get_contents($cache_file) or die ("Data not available");

$rss = new SimpleXMLElement($rss_file);

foreach ($rss->channel->item as $item) {
echo "<a href='{$item->link}'>$item->title</a><br>{$item->data}";
}

Yeah I know it's part of PHP, but by third party scripts I mean things other people had wrote, like simplepie.

Also, thanks for the link and the code exerpt!

 

Ah  :-\ the RSS mod I used to set up the feed for the news doesn't display username, so I've got to do it the way I have anyway.

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.