I am having a problem with my PHP code that I created to have news on the front. It opens that mySQL database that has everything for the news. You can see the output here.
Here is the code that I am using:
$link = mysql_connect("{host}","{username}","{password}");
mysql_select_db("{database}");
if (!$link)
{
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
if(array_key_exists("section" , $HTTP_GET_VARS)){}
else{$HTTP_GET_VARS["section"] = "front";}
switch($HTTP_GET_VARS["section"])
{
case "front";
echo "<br />\n";
$intX = 0;
$result = mysql_query("SELECT * FROM `news` WHERE imp=1");
echo $result;
if (!$result)
{
die('Invalid query: ' . mysql_error());
}
while ($row = mysql_fetch_array($result))
{
dispNews($row["date"], $row["title"], $row["body"], $row["section"], $row["page"], $row["dnld"], $row["imp"], $row["type"]);
$intX++;
}
$query = "SELECT * FROM `news` ORDER BY ID DESC";
$result = mysql_query($query);
while ($record = mysql_fetch_object($result))
{
if("$record->imp"!=1)
{
dispNews("$record->date", "$record->title", "$record->body", "$record->section", "$record->page", "$record->dnld", "$record->imp", "$record->type");
$intX++;
if($intX==5){break;}
}
}
break;
...
}
echo "<br />\n";
mysql_close($link);Apparently it stops at "if (!$result){die('Invalid query: ' . mysql_error());}". It doesn't even go on finishing the rest of the page. Does anybody know how to fix this?
Aqua-Soft Forums