I'm trying to return information from a function I've created, into a table. The information looks good, but it won't go inside my <td> tags, which is where it's being called from. Can anybody help me out?
Functions.php:
<?php
class getLatestComic
{
function get8bit()
{
$url = 'http://www.nuklearpower.com/archive.php';
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, FALSE);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, FALSE);
ob_start();
curl_exec($curl);
$data8bittheatre = ob_get_contents();
ob_end_clean();
$errno = curl_errno($curl);
$error = curl_error($curl);
if ($errno)
{
echo ("There was an error reported: <b>". $error ."<br>");
}
else
{
$start = "Latest strip:";
$end = "template-18.jpg";
$start_position = strpos($data8bittheatre, $start);
$end_position = strpos($data8bittheatre, $end) + strlen($end);
$length = $end_position - $start_position;
$data8bittheatre = substr($data8bittheatre, $start_position, $length);
$newstart = "Episode ";
$newend = "</a>";
$newstart_position = strpos($data8bittheatre, $newstart);
$newend_position = strpos($data8bittheatre, $newend) + strlen($newend);
$newlength = ($newend_position - 4) - $newstart_position;
$newdata8bittheatre = substr($data8bittheatre, $newstart_position, $newlength);
echo $newdata8bittheatre;
}
}
function showtextintags($text)
{
$text = preg_replace("/(\<script)(.*?)(script>)/si", "dada", "$text");
$text = strip_tags($text);
$text = str_replace("<!--", "<!--", $text);
$text = preg_replace("/(\<)(.*?)(--\>)/mi", "".nl2br("\\2")."", $text);
return $text;
}
}
?>
index.php:
<?php
require ("includes/SystemComponent.php");
require ("includes/MySQLDbConnect.php");
require ("includes/Functions.php");
$comicParse = new getLatestComic();
$connector = new MySQLDbConnect();
echo ("<html>\n");
echo ("<head>\n");
echo ("\t<title>Comic List</title>\n");
echo ("\t<link rel=\"stylesheet\" href=\"gray.css\" type=\"text/css\">\n");
echo ("</head>\n");
echo ("<body>\n");
$result = $connector->doQuery("SELECT * FROM `comics` ORDER BY `comicName` ASC");
$rows = $connector->numRows($result);
echo ("\t<table width=\"50%\" align=\"center\" valign=\"middle\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\">\n");
echo ("\t\t<tr>\n");
echo ("\t\t\t<td align=\"center\" width=\"33%\" class=\"td000000\"><b>Comic Name</b></td>\n");
echo ("\t\t\t<td align=\"center\" width=\"33%\" class=\"td000001\"><b>Last Comic Read</b></td>\n");
echo ("\t\t\t<td align=\"center\" width=\"34%\" class=\"td000001\"><b>Newest Comic Available</b></td>\n");
echo ("\t\t</tr>\n");
echo ("\t\t<tr>\n");
echo ("\t\t\t<td align=\"center\" colspan=\"3\">". $comicParse->get8bit() ."</td>\n");
echo ("\t\t</tr>\n");
for ($r = 0; $r < $rows; $r++)
{
$array = $connector->fetchArray($result, MYSQL_NUM);
echo ("\t\t<tr>\n");
echo ("\t\t\t<td align=\"center\" width=\"33%\" class=\"td000000\"><a href=\"". $array[2] ."\" class=\"a000000\" target=\"_blank\">". $array[0] ."</a></td>\n");
echo ("\t\t\t<td align=\"center\" width=\"33%\" class=\"td000001\">". $array[1] ."</td>\n");
echo ("\t\t\t<td align=\"center\" width=\"34%\" class=\"td000001\">". $comicParse->get8bit() ."</td>\n");
echo ("\t\t</tr>\n");
}
echo ("\t\t<tr>\n");
echo ("\t\t\t<td colspan=\"2\" class=\"td000002\"> </td>\n");
echo ("\t\t</tr>\n");
echo ("\t</table>\n");
echo ("</body>\n");
echo ("</html>\n");
?>
Thank you for any help offered.