All pastes #805307 Raw Edit

Untitled

public text v1 · immutable
·published 2007-12-04 05:42 UTC
rendered paste body
Hello,
I am having difficulty with displaying output properly on with my php.
The idea is when login is successfull the Welcome message should be displayed and below it a table with data fetched from the database.
However result is the opposite, first the table is displayed and after that is the Welcome message.

Bellow is partial code from the file checking login and fetching the data.

		if (mysql_num_rows($rs) == 1)
		{
			$output = "<p>Welcome $UserName.<br><p>";
			$sql = "SELECT * FROM CustInfo, Locations, Languages WHERE CustInfo.LANGID = Languages.LANGID AND CustInfo.LOCID = Locations.LOCID ORDER BY CustInfo.FNAME";
			$rs_sel = mysql_query($sql) or die ("my query failed");
			$thisCustID = ""; // placeholder for the Customer ID of the current row
			while ($row = mysql_fetch_array($rs_sel, MYSQL_ASSOC))
			{
				$tblRows = $tblRows."<tr><td>{$row['FNAME']}</td>
									 <td>{$row['LNAME']}</td>
									 <td><a href='form.php?CUSTID={$row['CUSTID']}'>Edit</a> | <a href='javascript:confirmDel(\"{$row['FNAME']}\",\"{$row['LNAME']}\",\"{$row['CUSTID']}\")'>Delete</a> </td></tr>";
			}

			mysql_free_result($rs);
			mysql_close($conn);

		}
		else
		{
			$output = "<p>User name or Password is invalid<br>";
		}
	}
	else
	{
		$output = "<p>Please provide both User name and Password<br>";
	}

}


?>

<br>
<b>
<table border=1 cellpadding=4>
<tr>
	<th>First Name</th>
	<th>Category</th>
	<th>Options</th>
</tr>
<?= $tblRows ?>
</table>
</b>