Ver Mensaje Individual
  #4 (permalink)  
Antiguo 19/04/2013, 15:15
Avatar de pdominguez0608
pdominguez0608
 
Fecha de Ingreso: enero-2013
Ubicación: Alcobendas
Mensajes: 40
Antigüedad: 13 años, 9 meses
Puntos: 0
Respuesta: dompdf y MySQL problema

este es el código (parte 1) de emitir_factura.php:
Código PHP:
<?php require_once('../Connections/conexiontienda.php'); 
include(
'../includes/convertToPDF.php'); 
?>
<?php
if (!function_exists('GetSQLValueString')) {
function 
GetSQLValueString($theValue, $theType, $theDefinedValue = '', $theNotDefinedValue = '') 
{
  if (
PHP_VERSION < 6) {
    
$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;
}
}

mysql_select_db($database_conexiontienda, $conexiontienda);
$query_DatosTienda = 'SELECT * FROM tblconstantes';
$DatosTienda = mysql_query($query_DatosTienda, $conexiontienda) or die(mysql_error());
$row_DatosTienda = mysql_fetch_assoc($DatosTienda);
$totalRows_DatosTienda = mysql_num_rows($DatosTienda);

if (!
function_exists('GetSQLValueString')) {
function 
GetSQLValueString($theValue, $theType, $theDefinedValue = '', $theNotDefinedValue = '') 
{
  if (
PHP_VERSION < 6) {
    
$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;
}
}

$varusuario_DatosUsuario = '0';
if (isset(
$_GET['usuario'])) {
  
$varusuario_DatosUsuario = $_GET['usuario'];
}
mysql_select_db($database_conexiontienda, $conexiontienda);
$query_DatosUsuario = sprintf('SELECT tblusuario.strNombre, tblusuario.strApellidos, tblusuario.strDni FROM tblusuario WHERE tblusuario.idUsuario = %s', GetSQLValueString($varusuario_DatosUsuario, 'int'));
$DatosUsuario = mysql_query($query_DatosUsuario, $conexiontienda) or die(mysql_error());
$row_DatosUsuario = mysql_fetch_assoc($DatosUsuario);
$totalRows_DatosUsuario = mysql_num_rows($DatosUsuario);

$varCompra_DatosCompra = '0';
if (isset(
$_GET['recordID'])) {
  
$varCompra_DatosCompra = $_GET['recordID'];
}
mysql_select_db($database_conexiontienda, $conexiontienda);
$query_DatosCompra = sprintf('SELECT * FROM tblcompra WHERE tblcompra.idCompra = %s', GetSQLValueString($varCompra_DatosCompra, 'int'));
$DatosCompra = mysql_query($query_DatosCompra, $conexiontienda) or die(mysql_error());
$row_DatosCompra = mysql_fetch_assoc($DatosCompra);
$totalRows_DatosCompra = mysql_num_rows($DatosCompra);

$varcompra_DatosLineas = '0';
if (isset(
$_GET['recordID'])) {
  
$varcompra_DatosLineas = $_GET['recordID'];
}
$varusuario_DatosLineas = '0';
if (isset(
$_GET['usuario'])) {
  
$varusuario_DatosLineas = $_GET['usuario'];
}
mysql_select_db($database_conexiontienda, $conexiontienda);
$query_DatosLineas = sprintf('SELECT * FROM tblcarrito WHERE tblcarrito.idUsuario = %s AND tblcarrito.intTransaccionEfectuada = %s ORDER BY tblcarrito.idProducto ASC', GetSQLValueString($varusuario_DatosLineas, 'int'),GetSQLValueString($varcompra_DatosLineas, 'int'));
$DatosLineas = mysql_query($query_DatosLineas, $conexiontienda) or die(mysql_error());
$row_DatosLineas = mysql_fetch_assoc($DatosLineas);
$totalRows_DatosLineas = mysql_num_rows($DatosLineas);

$varusurio_DatosDireccion = '0';
if (isset(
$_GET['usuario'])) {
  
$varusurio_DatosDireccion = $_GET['usuario'];
}

$direccionFactura= $row_DatosCompra['intFacturacion'];

$varfactura_DatosDireccion = '0';
if (isset(
$direccionFactura)) {
  
$varfactura_DatosDireccion = $direccionFactura;
}
mysql_select_db($database_conexiontienda, $conexiontienda);
$query_DatosDireccion = sprintf('SELECT * FROM tbldatoscomprador WHERE tbldatoscomprador.idDireccion = %s AND tbldatoscomprador.relUsuario = %s', GetSQLValueString($varfactura_DatosDireccion, 'int'),
GetSQLValueString($varusurio_DatosDireccion, 'int'));
$DatosDireccion = mysql_query($query_DatosDireccion, $conexiontienda) or die(mysql_error());
$row_DatosDireccion = mysql_fetch_assoc($DatosDireccion);
$totalRows_DatosDireccion = mysql_num_rows($DatosDireccion);
?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
<title>Emisi&oacute;n de factura</title>
<link href='../estilo/twoColFixLtHdr.css' rel='stylesheet' type='text/css' />
__________________
http://www.facebook.com/Punto3Web