help!
nonostante la mia scarsità in php sono riuscito a fare uscire dei dati in xls richiamandoli da DB
sto impazzendo!
nonostante la query sia giusta fatta su altre tab e visualizzazioni (la stessa query in pagina php non funziona!)

su 3 records presenti mi rilascia solo il 2 e 3, il primo non c'è verso di farlo vedere! credo si tratti di sintassi e di array ma non sono esperto, chi mi aiuta ? dove sbaglio?

Grazie!

codice
Codice PHP:
<?php require_once('../Connections/testmp.php'); ?>
<?php
$filename 
"dati.xls";
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: inline; filename=$filename");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache");
header("Cache-Control: post-check=0,pre-check=0");
header("Cache-Control: max-age=0");
header("Pragma: no-cache");
?>
<?php
if (!isset($_SESSION)) {
  
session_start();
}
$MM_authorizedUsers "";
$MM_donotCheckaccess "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers$strGroups$UserName$UserGroup) { 
  
// For security, start by assuming the visitor is NOT authorized. 
  
$isValid False

  
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  
if (!empty($UserName)) { 
    
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    
$arrUsers Explode(","$strUsers); 
    
$arrGroups Explode(","$strGroups); 
    if (
in_array($UserName$arrUsers)) { 
      
$isValid true
    } 
    
// Or, you may restrict access to only certain users based on their username. 
    
if (in_array($UserGroup$arrGroups)) { 
      
$isValid true
    } 
    if ((
$strUsers == "") && true) { 
      
$isValid true
    } 
  } 
  return 
$isValid
}

$MM_restrictGoTo "login_no.php";
if (!((isset(
$_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers$_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  
$MM_qsChar "?";
  
$MM_referrer $_SERVER['PHP_SELF'];
  if (
strpos($MM_restrictGoTo"?")) $MM_qsChar "&";
  if (isset(
$QUERY_STRING) && strlen($QUERY_STRING) > 0
  
$MM_referrer .= "?" $QUERY_STRING;
  
$MM_restrictGoTo $MM_restrictGoTo$MM_qsChar "accesscheck=" urlencode($MM_referrer);
  
header("Location: "$MM_restrictGoTo); 
  exit;
}
if (!
function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}
$colname_Recordset1 "0";
if (isset(
$_GET['userfrm'])) {
  
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['userfrm'] : addslashes($_GET['userfrm']);
}

$colname_Recordset1 "0";
if (isset(
$_SESSION['MM_Username'])) {
  
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_testmp$testmp);
$query_Recordset1 sprintf("SELECT * FROM cc WHERE usr = %s ORDER BY num ASC"GetSQLValueString($colname_Recordset1"text"));
$Recordset1 mysql_query($query_Recordset1$testmp) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Foglio Dati Carta di Credito</title>
<style type="text/css">
<!--
.Stile7 { 
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #003399;
}
-->
</style>
<?php
echo"<table border='0' cellspacing='3' cellpadding='3' div align='center'>"
echo
"<tr><td><img src=/img/mplogo.jpg'></td><td></td></tr>
"
;
echo
"<tr><td></td><td></td></tr>
"

echo
"<tr><td></td><td></td></tr>
"
;
echo
"<tr><td></td><td></td></tr>
"
;
echo
"<tr><td></td><td></td></tr>
"

echo
"<tr><td></td><td></td></tr>
"
;
echo
"<tr><td></td><td></td></tr>
"
;
echo
"</TABLE>";
echo
"<table width='100%' border='1' cellspacing='2' cellpadding='3' div align='center'>";
echo
"<tr><td></td><td>CC $row_Recordset1[ccnum]</td></tr><tr><td></td><td>[b] $row_Recordset1[usr] $row_Recordset1[nome] [/b]</td></tr>
"
;
echo
"<tr><td><span class='Stile7'>[b]N.[/b]</span></td><td><span class='Stile7'>[b]DESCRIZIONE[/b]</span></td><td><span class='Stile7'>[b]FORNITORE</td>[/b]</span><td><span class='Stile7'>[b]FATT. N.[/b]</span></td><td><span class='Stile7'>[b]DEL[/b]</span></td><td><span class='Stile7'>[b]CO. GE.[/b]</span></td><td><span class='Stile7'>[b]CDC[/b]</span></td><td><span class='Stile7'>[b]O. I.[/b]</span></td><td><span class='Stile7'>[b]IMPONIBILE[/b]</span></td><td><span class='Stile7'>[b]ALIQ.[/b]</span></td><td><span class='Stile7'>[b]IVA[/b]</span></td><td><span class='Stile7'>[b]USCITE[/b]</span></td><td><span class='Stile7'>[b]ENTRATE[/b]</span></td><td><span class='Stile7'>[b]SALDO[/b]</span><td><span class='Stile7'>[b] REG.NE N.[/b]</span></td><td><span class='Stile7'>[b]DEL[/b]</span></td></tr>";

while(
$array mysql_fetch_array($Recordset1))
{
$anumber_format($array['saldc'],2,",","."); 
echo
"<tr><td>$array[num]</td><td>$array[des]</td><td>$array[codfor]</td><td>$array[fatt]</td><td>$array[data]</td><td>$array[coge]</td><td>$array[cdc]</td><td>$array[oi]</td><td>$array[imp]</td><td>$array[ali]</td><td>$array[iva]</td><td>$array[totusc]</td><td>$array[entr]</td><td>$a</td><td>$array[reg]</td><td>$array[data1]</td></tr>"
}

echo
"<tr><td></td><td></td></tr>
"
;
echo
"<tr><td></td><td></td></tr>
"
;
echo
"<tr><td></td><td><span class='Stile7'>[b]IL RESPONSABILE[/b]</span></td></tr>
"

echo
"</TABLE>";
?>
<?php
mysql_free_result
($Recordset1);
?>