php query not returning a value of site built in code codeig
Posted: Thu Jul 31, 2014 7:06 am
having an issue build a news detail page (newsarticle.php)
the orginal site was built in codeigniter and am just adding a couple of other pages one being a news detail page. the trouble is the news detail page is not displaying any records. the link from the news list is call the correct newsID.
the news list page
I know there isnt an extension at the end of the newsarticle (newsarticle.php) this is intentional (something with the framework)
and newsarticle (newsarticle.php)
any help would be appreciated
thanks
the orginal site was built in codeigniter and am just adding a couple of other pages one being a news detail page. the trouble is the news detail page is not displaying any records. the link from the news list is call the correct newsID.
the news list page
Code: Select all
<?php
mysql_select_db($database_ab, $ab);
$query_rsNews = "SELECT * FROM antontBattyNews WHERE newsDate LIKE '%2014%' ORDER BY newsID DESC";
$query_limit_rsNews = sprintf("%s LIMIT %d, %d", $query_rsNews, $startRow_rsNews, $maxRows_rsNews);
$rsNews = mysql_query($query_limit_rsNews, $ab) or die(mysql_error());
$row_rsNews = mysql_fetch_assoc($rsNews);
<?php do { ?>
<?php echo $row_rsNews['newsDate']; ?><dt><strong>
<?php echo $row_rsNews['newsTitle']; ?></strong><br>
</dt>
<dd><?php echo TrimByLength($row_rsNews['newsDesc'], 100, true); ?><a href="newsarticle?newsID=<?php echo $row_rsNews['newsID']; ?>">Read More</a></dd>
<?php } while ($row_rsNews = mysql_fetch_assoc($rsNews)); ?>I know there isnt an extension at the end of the newsarticle (newsarticle.php) this is intentional (something with the framework)
and newsarticle (newsarticle.php)
Code: Select all
<?php
$colname_rsNews = "-1";
if (isset($_GET['newsID'])) {
$colname_rsNews = $_GET['newsID'];
}
mysql_select_db($database_ab, $ab);
$query_rsNews = sprintf("SELECT * FROM antontBattyNews WHERE newsID = %s", GetSQLValueString($colname_rsNews, "int"));
$rsNews = mysql_query($query_rsNews, $ab) or die(mysql_error());
$row_rsNews = mysql_fetch_assoc($rsNews);
$totalRows_rsNews = mysql_num_rows($rsNews);
?>
<p><?php echo $row_rsNews['newsDate']; ?></p>
<p><?php echo $row_rsNews['newsTitle']; ?><br>
<?php echo $row_rsNews['newsDesc']; ?></p>
thanks