php code in index.php
In this case, $catid=18
I’m using a mysql database
require("LinkSql.inc.php");
$db = new LinkSQL($DBName);
$catalogname = $db->getcatalognamebyid($catid);
$cataresult = $db->getchildcatalog($catid);
$catalinkresult = $db->getlinks($page,$record,$catid);
$sponsorlinkresult = $db->getsponsorlinks($catid);
Functions in LinkSql.inc.php
[CODE] function getchildcatalog($catid)
{
$sql = “select * from linkexcatalog where parentid=’$catid’ order by catalogid”;
$result = $this->select($sql);
return $result;
}
function getlinks($page,$record,$catid)
{
$start = $page*$record;
$sql = “select * from linkex where catalogid=’$catid’ and isdisplay=1 and isponsor=0 order by linkexid DESC LIMIT $start,$record”;
$result = $this->select($sql);
return $result;
}
function getsponsorlinks($catid)
{
$sql = “select * from linkex where catalogid=’$catid’ and isdisplay=1 and isponsor=1 order by linkexid DESC”;
$result = $this->select($sql);
return $result;
}[/CODE]
The results:
[ICODE]$catalogname = $db->getcatalognamebyid($catid);[/ICODE] works correctly and gives me the catalog name of Services
The other three show the following:
cataresult = Array
catalinkresult = Array
sponsorlinkresult = Array
How can I get the word “Array” to show the proper info from the mysql database?
I have included the table code of the mysql linkexcatalog.
[CODE]
| catalogid | catalogname | description | parentid | linknum | coolnum |
|---|---|---|---|---|---|
| 1 | Advertising | 0 | 1 | 1 | |
| 2 | Attorneys | 0 | 0 | 0 | |
| 3 | Auto | 0 | 1 | 1 | |
| 4 | Beauty Shops | 0 | 0 | 0 | |
| 5 | Car Dealers | 0 | 0 | 0 | |
| 6 | Churches | 0 | 0 | 0 | |
| 7 | Day Care | 0 | 0 | 0 | |
| 8 | Florist | 0 | 0 | 0 | |
| 9 | Funeral Homes | 0 | 0 | 0 | |
| 10 | Grocers | 0 | 0 | 0 | |
| 12 | Hardware | 0 | 0 | 0 | |
| 13 | Handy Man | 0 | 0 | 0 | |
| 14 | Medical | 0 | 0 | 0 | |
| 15 | Plumbers | 0 | 0 | 0 | |
| 16 | Recreation | 0 | 0 | 0 | |
| 17 | Restaurants | 0 | 0 | 0 | |
| 18 | Services | 0 | 0 | 0 | |
| 19 | Travel & Tourism | 0 | 0 | 0 | |
| 20 | Uncategorized | 0 | 0 | 0 |