Never had this problem before but just switched to using php my admin on a new server.

The line in question is bolded but the error I keep getting is -

Notice: Undefined variable: userdata in C:\Program Files\EasyPHP 3.0\www\swiftdistributors\memberspage.php on line 30
Code:
<?php

require_once('database/database.php');

$query = ("SELECT users_table.first_name, users_table.last_name, users_table.company, users_table.login_count, users_table.time_stamp, users_table.sales_contact, users_table.email, users_table.sales_contact, sales_contact_table.sales_contact, sales_contact_table.email FROM users_table, sales_contact_table WHERE users_table.sales_contact = sales_contact_table.sales_contact AND  users_table.username = '$_SESSION[username]'");

$result = mysql_query($query) or die("Your login reguest has failed please contact us immediately <a href=\"mailto:webmaster@davidbrown.com\" class=\"centerlink\">contact us</a>" . $query);
$num_rows = mysql_num_rows($result);
if ($num_rows > 0)
{
while($row = mysql_fetch_assoc($result))
{
$logintext = <<<LOGINTEXT
<ul class="ulmembersdetails">
<li>Name: $row[first_name] $row[last_name]</li>
<li>Company: $row[company]</li>
<li>Your last login was: $row[time_stamp]</li>
<li>You have logged in $row[login_count] times</li>
<li>Your local sales contact is: <a href="mailto:$row[email]"  class="centerlink">$row[sales_contact]</a></li>
</ul>
LOGINTEXT;
}}


$query = ("SELECT order_sales_table.company, order_sales_table.past_orders, order_sales_table.current_orders, order_sales_table.past_sales, order_sales_table.current_sales, order_sales_table.currency, order_sales_table.last_upload, users_table.access_rights, users_table.company FROM order_sales_table, users_table WHERE order_sales_table.company = users_table.company AND users_table.username = '$_SESSION[username]'");

$result = mysql_query($query) or die("Your Order &amp; Sales query has failed please contact us immediately <a href=\"mailto:webmaster@davidbrown.com\"class=\"centerlink\">contact us</a>" .$query );
$num_rows = mysql_num_rows($result);
if ($num_rows > 0)
{
while($row = mysql_fetch_assoc($result))
{

if ($row['access_rights'] == "A") {
$adminrights = "<p class=\"p\">You have administration rights within Swift Distirbutors please use the following link if you wish to make any administration changes <a href=\"database/admincontrol/createusersform.php\" class=\"centerlink\">Admin Control Panel</a></p>";
}
$pastorders = number_format($row['past_orders'],2);
$currentorders = number_format($row['current_orders'],2);
$pastsales = number_format($row['past_sales'],2);
$currentsales = number_format($row['current_sales'],2);


$userdata = <<<USERDATA
<table class="userdatatable">
  <caption>Order Data</caption>
<tr>
<th>Orders 2008</th>
<th>Orders 2009</th>
</tr>
<tr>
<td>$row[currency] $pastorders</td>
<td>$row[currency] $currentorders</td>
</tr>
<tr>
<td colspan="2">Order Data last updated: $row[last_upload]</td>
</tr>
</table>

<table class="userdatatable">
  <caption>Sales Data</caption>
<tr>
<th>Sales 2008</th>
<th>Sales 2009</th>
</tr>
<tr>
<td>$row[currency] $pastsales</td>
<td>$row[currency] $currentsales</td>
</tr>
<tr>
<td colspan="2">Sales Data last updated: $row[last_upload]</td>
</tr>
</table>
USERDATA;


}}
?>
Cheers for any help