i can't get my PHP/MySQL to work
Posted: Tue Mar 04, 2008 6:42 am
I'm using Joomla! 1.5 and I'm still new to it, basically. Also, I would still consider myself a beginner to PHP/MySQL. So, I have a website that I built myself (http://africanmyspacelayouts.com/) and I want to recreate that exact same site with the exact functionality in Joomla.
here's the code I've been trying to get Joomla to execute, via IncludePHP plugin :
Here's the error I get when I reload my Joomla frontpage:
Please help me.
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.