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