I've submitted a webpage using the code below to my joomla root directory.

<?php
$value = trim($_POST['opts']);

if ($value){ 
$db = "my_db";
$link = mysql_connect('localhost',$me,$my_password);

if(!$link) die("Error 1 ".mysql_error());

mysql_select_db($db);

 **$query =  "SELECT introtext,fulltext FROM jos_content WHERE title='$value' ";** 

 $result = mysql_query($query);

 **if(!$result) die("Error 2 ".mysql_error());**

 $obj = mysql_fetch_array($result);

 $obj_f = $obj[0];

 $lenght = strlen($obj_f);
 $header2 = strpos($obj_f, "Did you know");
 $header3 = strstr($obj_f, "Summary");

$third_part = $header3; 
$first_part = substr($obj_f, 0, ($header2 - 1));
$second_part = substr($obj_f, $header2,((strpos($obj_f, "Summary")) - $header2) );             
 }
?>

however , after i change my choose(http://sanatural.co.za/sanp/test.php) i recieve this error message: Error 2 You possess an error inside your SQL syntax look into the manual that matches your MySQL server version for the best syntax to make use of near 'fulltext FROM jos_content WHERE title='Arthritis'' at line 1

The code outlined in bold is how i believe the issue may be. Help.

Fulltext is really a mysql keyword and also you must escape it. Replace:

$query = "SELECT introtext,fulltext FROM jos_content WHERE title='$value' ";

with

$query = "SELECT `introtext`,`fulltext` FROM jos_content WHERE title='$value' ";

This really is a little off subject, but a good way to make use of PHP in Joomla is thru the PHP Component. http://www.fijiwebdesign.com/products/joomla-php-pages.html This enables you to definitely put add PHP in Joomla as though it were a Joomla Component.

If you would like something quick, you'll be able to also employ the PHP Module. http://www.fijiwebdesign.com/products/joomla-php-module.html

Just install either, add your PHP, and combine it with the Joomla menu. After that you can make use of the Joomla API that will simplify what for you to do within Joomla.

For instance, your database queries might be:

// Joomla already has a connection to the DB 
// available here as a Singleton in the Factory pattern
$Db =& JFactory::getDBO();

// querying the db
$Db->setQuery('SELECT `introtext`,`fulltext` FROM #__content WHERE title='.$Db->Quote($value).' LIMIT 1';
// retrieving a single row as an object
$article = $Db->loadObject();
// handle errors
if($Db->getErrorNum()) {
   JError::raiseError( 500, $Db->stderr());
}

//Then accessing each column/property would look something like:

$intro = $article->introtext;
$text = $article->fulltext;

The entire Database API is recorded here: http://api.joomla.org/Joomla-Framework/Database/JDatabase.html