here's the code I've been trying to get Joomla to execute, via IncludePHP plugin :
Code: Select all
<?php
$option['driver'] = 'mysql'; // Database driver name
$option['host'] = 'localhost'; // Database host name
$option['user'] = '<MY USERNAME>'; // User for database authentication
$option['password'] = '<MY PASSWORD>'; // Password for database authentication
$option['database'] = '<MY DB NAME>'; // Database name
$option['prefix'] = ''; // Database prefix (may be empty)
$dbh = & JDatabase::getInstance( $option );
$category = "Art";
$result = mysql_query("SELECT * FROM `#_layouttable` WHERE `category` = '{$category}' ORDER by name;", $dbh);
$dbh->setQuery($result);
$name = $dbh ->loadResult();
$myrow = mysql_fetch_array($name);
?>
<table align="center" cellspacing="10" class="categories"><!-- start table class categories -->
<?php
do
{
printf("<tr>
<td class=\"layoutpic\">
<a class=\"layoutnamelink\" href=\"preview.php?name=%s\" target=\"preview\" title=\"%s Layouts\" >%s<br />
<img src=\"../images/%s\" /><br />
<div align=\"center\">Preview this African MySpace Layout</div></a>
</td>
</tr>", $myrow["name"], $myrow["name"], $myrow["name"], $myrow["pic"]);
}while($myrow = mysql_fetch_array($resultcategory));
?>
</table><!-- end table class categories -->
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\xampp\htdocs\joomla2\myincludes\categs.php on line 14
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\joomla2\myincludes\categs.php on line 17
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\joomla2\myincludes\categs.php on line 31
Please help me.