I am new to php and html.
I have been modifying an open source php project but I recently
upgraded my distro and it has php 5.2 instead of 4.1.
Now the code is broken but none of my php books or web guides
explains what is wrong with this code:
Code:
<?
session_start();
include 'data.php';
$reload_to_install = str_replace("index", "install", $_SERVER['PHP_SELF']);
if (!isset($database_host)) header("Location: http://$_SERVER[HTTP_HOST]$reload_to_install");
if (!isset($_GET["from"])) {
$from = '0';
} else {
$from = $_GET["from"];
}
if (!empty($_SESSION["user"])) $username = explode ('@', strtoupper($_SESSION["user"]));
/////////////start define functions//////////////////////
function show_results($result,$select,$from,$show) {
include 'data.php';
$i = $from;
$link = mysql_connect($database_host, $database_user, $database_password);
mysql_select_db ($database_name);
echo '<TABLE BORDER="0" CELLPADDING="5" CELLSPACING="5" WIDTH="100%">';
while ($paper = mysql_fetch_array($result)){
$i = $i + 1;
echo "
<TR>
<TD>
$i. <U>$paper[authors]</U><BR>
<B>$paper[title]</B><BR>
<I>$paper[journal] $paper[date1]</I><BR>";
What I see on the browser is:
Quote:
; while ($paper = mysql_fetch_array($result)){ $i = $i + 1; echo " $i. $paper[authors]
$paper[title]
$paper[journal] $paper[date1]
"; if ($show == 'abstract') { print "Brief"; } else { print "Abstract"; } if (isset($_SESSION["auth"])) { echo " | Full text | Edit"; } if (date('Y-m-d') == $paper['date2']) { $today = 'Today!'; } else { $today =''; } echo "
Category: ".str_replace("|", ", ", $paper[category])." "; if ($show == 'abstract') echo "
|
Is this a problem with the echo syntax or is html no longer passed via echo? Is there a way to get php5.2 to give php4.2 behavior?
Can someone suggest where I should look to fix this code?