Hi, the problem is following:
PHP 4.2.1 is working with Apache 1.3.x fine, but is ignoring "if ($id))" and is going directly to "else..." on my Windows 2000 Pro machine, while on Linux server is executed. What is wrong in the configuration? Link to the xxx.php?id=x is created by the script, and on Linux machine it works, but on my Windows 2000 Pro "if (($id))" is ignored and script goes to the "else" section, opening page with the table of content, not with the particular news, specified in the address field by the id=x. Here is the script:
If I write instead of $id specific digit, "if" is executed, but if it is left as "$id", it is ignored... Can you suggest what's wrong?
<?php
$db = mysql_connect(localhost, root);
mysql_select_db(database_name,$db);
if (($id))
{
$text = "select * from news where id=$id and status='1'";
$result = mysql_query($text);
if ($myrow=@mysql_fetch_array($result))
{
echo "<p><font class=H4><b>".$myrow[title]."</b></font></p>\n";
echo "<p><font class=normal>$myrow[body]</font></p><br>\n";
echo "<p><a href=news-bauc.php>Atpakaï uz Baltijas Ûnijas ziòu satura râdîtâju</font></a></p>\n";
}
else
{
echo "<font class=error>There is no document with such ID!</font>";
}
}
else
{
$text = "select id,status,country,title,intro,start_date from news status='1' order by start_date asc limit 5;";
$result = mysql_query($text);
if ($myrow=@mysql_fetch_array($result))
{
do
{
echo "
<tr><td width=19 valign=top>
<img src='../_images/bullets/ball-crimson.gif' width=13 height=13></td>
<td width=90 valign=top><p><font class=normal>
$myrow[start_date]</font></p></td>
<td valign=top><p><font class=normal>
<a href=\"".$PHP_SELF."?id=".$myrow[id]."\">".$myrow[title]."</a></p></td></tr>
<tr><td valign=top> </td><td valign=top> </td>
<td valign=top><font class=small>$myrow[intro].<br></font>
</td></tr>
\n";
}
while ($myrow=mysql_fetch_array($result));
}
else
{
echo "<font class=error>It seems that db is empty...</font>";
}
}
?>