Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/06/2004, 04:34
Avatar de Kalili
Kalili
 
Fecha de Ingreso: enero-2002
Ubicación: Gate 69
Mensajes: 210
Antigüedad: 22 años, 3 meses
Puntos: 0
Error al mandar email

Hola a todos
tengo este problema.
Quiero mandar un email en formato html.
Para eso me he creado el siguiente script

Código PHP:
$correo ="<html>";
$correo .= "<head>";
$correo .= "</head>";
$correo .= "<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>";
$correo .= "<table width=80% border=0 cellspacing=0 cellpadding=10 align=center>";
$correo .= "<tr>";
$correo .= "<td><h1>Uw bestellijst bij Biometdentaal</h1></tr></table>";
$correo .= "<table width=80% cellspacing=0 cellpadding=0 border=0 align=center>";
$correo .= "<tr>";
$correo .= "<td width=10% height=25 bgcolor=AD2952> <div align=center><font face=verdana size=1 color=white>&nbsp;&nbsp;<b>Aantal</b></font></div></td>";
$correo .= "<td width=13% height=25 bgcolor=AD2952> <div align=center><font face=verdana size=1 color=white><b>Code</b> </font> </div></td>";
$correo .= "<td width=47% height=25 bgcolor=AD2952> <div align=center><font face=verdana size=1 color=white><b>Product</b> </font> </div></td>";
$correo .= "<td width=18% height=25 bgcolor=AD2952> <div align=right><font face=verdana size=1 color=white><b>Prijs incl btw</b> </font></div></td></tr>";

        
$database Conectar_db ();
        
$totalCost 0;
        
$srt_sql ="select * from cart inner join products on CART.IDPRODUCT = PRODUCTS.IDPRODUCT where CART.IDCOOKIE = '" GetCartId() . "' order by PRODUCTS.DESCRIPTION asc";
        
$resultado mysql_query($str_sql,$database);
                    
        while(
$fila mysql_fetch_array($resultado))
        {
            
$totalCost += ($fila["QTY"] * $fila["PRIJZEN_INCL"]);

            
$correo .= "<tr>";
            
$correo .= "<td width=13% height=25> <div align=left><font face=verdana size=1 color=black>";
            
$correo .= $fila["QTY"];
            
$correo .= "</font></div></td>";
            
$correo .= "<td width=13% height=25> <div align=left><font face=verdana size=1 color=black>";
            
$correo .= $fila["CODE"];
            
$correo .= "</font></div></td>";
            
$correo .= "<td width=47% height=25> <div align=left><font face=verdana size=1 color=black>"
            
$correo .= $fila["DESCRIPTION"];
            
$correo .= "</font></div></td>";
            
$correo .= "<td width=18% height=25> <div align=right><font face=verdana size=1 color=black><br><br>";
            
$correo .= $number_format($fila["PRIJZEN_INCL"], 2","".");
            
$correo .= "&euro;</font></div></td></tr></table>";
        }
            
        
$correo .= "<table width=80% cellspacing=0 cellpadding=0 border=0 align=center><tr>";
        
$correo .= "<td width=100% align=right><font face=verdana size=2 color=black><b>Total:";
        
$correo .= number_format($totalCost2","".");
        
$correo .= "&euro;</b></font></td></table>";        
        
$headers "MIME-Version: 1.0\r\n"
        
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n"

        
$headers .= "From: xxx<mi email>\r\n"

        
$destinatario "remitente email";
        
$asunto "Lista de copras";
        
mail($destinatario,$asunto,$correo,$headers); 
Hasta el while me lo manda bien pero me da error en el while

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /usr/domain/biomet1/www/data/test/php/enviar_correo.php on line 29

Decir que la linea 29 es donde empieza el while

Alguien podria decirme donde esta el error por favor
Gracias

A peticion de appletalk añado la funcion conectar_db
Código PHP:
function Conectar_db ()
{
    
$usuario ="root";
    
$password ="";
    
$hostname ="localhost";

    
$database mysql_pconnect($hostname,$usuario,$password) or die("Imposible establecer la conexion");
    
mysql_select_db("biomet") or die("Imposible seleccionar la base de datos");
    
    return(
$database);

__________________
saludos

Última edición por Kalili; 28/06/2004 a las 08:10