Jump to content

Joomla - Transport news


CryptoN

Recommended Posts

Hi everyone!

 

The code above takes the news from a table and insert the news into Joomlas jos_content

 

<?php

    $user = "****";
    $pass = "****";
    $host = "localhost";
    $database = "nh";
    $connection = mysql_connect($host,$user,$pass)
            or die(mysql_error());

    mysql_select_db($database)
        or die(mysql_error());

  
    $query = "SELECT * FROM admin_news ORDER BY nid DESC LIMIT 10";
    $result = mysql_query($query)
        or die(mysql_error());

  
    while($row = mysql_fetch_array($result))
    {
   
        $row['headline'];
        $row['nick'];

        $row['date'];

        $row['preview'];
        $row['news'];
        
        
        
            $database2 = "joomla";
    

    mysql_select_db($database2,$connection)
        or die(mysql_error());



$query2 = "INSERT INTO jos_content(
title,
alias,
title_alias,
introtext,
`fulltext`,
state,
sectionid,
mask,
catid,
Created,
Created_by,
Created_by_alias,
modified,
modified_by,
checked_out,
checked_out_time,
publish_up,
publish_down,
images,
urls,
attribs,
version,
parentid,
ordering,
metakey,
metadesc,
access,
hits,
metadata) VALUES(
'".mysql_real_escape_string($row['headline'])."',
'',
'',
'".mysql_real_escape_string($row['preview'])."',
'".mysql_real_escape_string($row['news'])."',
'',
2,
'',
1,
'',
62,
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'')";

    

    $result2 = mysql_query($query2)
        or die(mysql_error());


        
    }

echo "done";
        
?>

 

The problem is when I set the sectionid to 2, which is the id for the News Section. But in the administrator, the news doesn't belong to any section, and it is defined as "Uncategorised".

 

How can I solve this?

Link to comment
https://forums.phpfreaks.com/topic/192808-joomla-transport-news/
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.