php code to display a article

For Joomla! 1.0 Coding related discussions.
Locked
defje
Joomla! Apprentice
Joomla! Apprentice
Posts: 26
Joined: Wed Oct 05, 2005 2:06 pm

php code to display a article

Post by defje » Thu Dec 01, 2005 9:58 am

Simple question

is it possible to show a article by doing a sql query with, more or less outside of joomla (in a joomla component that supports html/php pieces)

i have some code myself but it only works for showing an article title:

Code: Select all

<?php
global $database;
$id = mosGetParam($_REQUEST, 'ff_param_joomlaid',''); 
$query = "SELECT title from jos_content WHERE id = '$id'";
$database->setQuery($query);
$title = $database->loadResult();
return $title;
?>
works

but

Code: Select all

<?php
global $database;
$id = mosGetParam($_REQUEST, 'ff_param_joomlaid',''); 
$query = "SELECT fulltext from jos_content WHERE id = '$id'";
$database->setQuery($query);
$fulltext = $database->loadResult();
return $fulltext;
?>
doesn't :(, some kind of protection i guess, do i miss some code?

defje
Joomla! Apprentice
Joomla! Apprentice
Posts: 26
Joined: Wed Oct 05, 2005 2:06 pm

Re: php code to display a article

Post by defje » Thu Dec 01, 2005 10:03 am

Even more stupid is that this DOES work when i do it for the introtext!

de
Joomla! Ace
Joomla! Ace
Posts: 1477
Joined: Thu Aug 18, 2005 9:06 am
Contact:

Re: php code to display a article

Post by de » Thu Dec 01, 2005 8:27 pm

fulltext is a reserved word in MySQL and you need to escape it using backticks.


Locked

Return to “Joomla! 1.0 Coding”