I hiave a page that I'm using to display just one cell from a MySQL table - a cell in a field that contains articles about states and nations. Let's say the page is named alaska.php, and it has a big include in the body section. The include, in turn, includes another page with the following:
When I was tweaking the code, trying to get it to work, I frequently got "No Database Selected" error messages. They were often triggered when I refereshed the page; everything would work fine until I refreshed it, when I got an error message. If I refreshed it again, then everything would once again be OK.PHP Code:<?php
$todayDate = date("m-d-Y");
?>
<?php require_once('../../../../Connections/World.php');
mysql_select_db($database_World, $World);
$query_Statesarticles = "SELECT statesarticles.ArticleS from statesarticles WHERE statesarticles.SCode = '{$mycode}'";
$Statesarticles = mysql_query($query_Statesarticles, $World) or
die(mysql_error());
// send it to mysql (step 2.)
while ($row_Statesarticles = mysql_fetch_assoc($Statesarticles) )
{
// loop throught the resulting record set and display each row (step 4.)
echo $row_Statesarticles['ArticleS'];
}
?>
Finally, it was working perfectly - then I must have done something wrong, and "No Database Selected" is permanently displayed. The table is named statesarticles, and I'm selecting a cell from the ArticleS field. Any idea what I'm doing wrong?
Also, does my code look good for my purpose? I thought I might need the "loop through" function for displaying a single cell, but I couldn't remove it without wrecking everything.
Thanks.




Bookmarks