Porkie Posted August 15, 2009 Share Posted August 15, 2009 hey i seem to get an error basically saying that it cannot find the data but im very confused because all its doing is loading the data from a database. Can someone please clarify where iam going wrong. http://www.getrecognized.co.uk/rss_show.php <?php { ini_set ("display_errors", "1"); error_reporting(E_ALL); require('core.inc.php'); echo page_header(); } $con = mysql_connect(""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("", $con); $q ="SELECT * FROM news "; $sql5 = mysql_query($q); $rsstitle = $row['rsstitle']; echo '<table><tr>'; echo '<td>'; echo 'RSS Feed'; echo '</td>'; echo '</tr>'; while ($row = mysql_fetch_assoc($sql5)) { echo '<tr>'; echo '<td>'; echo $row['$rsstitle']; echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>'; echo $row['rssdescription']; echo '</td></tr>'; echo '<tr>'; echo '<td>'; echo $row['rsslink']; echo '</td></tr>'; echo '</table>'; } ?> Cheers Link to comment https://forums.phpfreaks.com/topic/170409-undifined-error-in-php/ Share on other sites More sharing options...
taquitosensei Posted August 15, 2009 Share Posted August 15, 2009 you have single quotes around the variable you're using as a keys. Either this isn't mean to be a variable in which case you need to drop the $ or you need to lose the single quotes. PHP doesn't parse variables in single quotes. Link to comment https://forums.phpfreaks.com/topic/170409-undifined-error-in-php/#findComment-898930 Share on other sites More sharing options...
ignace Posted August 15, 2009 Share Posted August 15, 2009 Please don't use: if (!$con) { die('Could not connect: ' . mysql_error()); } Imagine you being the clueless visitor who visits your website at the time your SQL server kicks it and sees: Could not connect: Can't connect to MySQL server on 'localhost' (2003) Instead log these and display a nice error message to your visitor that you are having some technical difficulties. Link to comment https://forums.phpfreaks.com/topic/170409-undifined-error-in-php/#findComment-898965 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.