Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/10/2012, 08:23
francocsanchez
 
Fecha de Ingreso: abril-2012
Ubicación: Mendoza
Mensajes: 43
Antigüedad: 12 años, 1 mes
Puntos: 2
Pregunta Consulta sobre variable $_GET

Buenos dias, estoy pasando por GET el valor de una variable tipo text, el campo es el nombre de un tecnico por ejemplo
Franco Sanchez
Cuando lo paso tengo que hacer una consulta para filtrar las ventas de ese tecnico, pero cuando lo hago me tira el siguiente error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Sanchez ORDER BY fecha_venta DESC' at line 1

Que puede ser?
Les dejo los codigos para ver si es un problema de sintaxis

PAGINA DONDE LLEGAN LOS DATOS
Cita:
<?php
include("../../Admin/conn.php");
$tecnico=$_GET['instalador'];
$VistaVenta = VistaVentas($tecnico);
$row = mysql_fetch_array($VistaVenta);
?>
<!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">

<?php
include("../../Style/Include/hojas.php");
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>

<body>
<div class="container">
<?php
include("../../Style/Include/nvar.php");
?>

<ul class="breadcrumb">
<li>
<a href="<?php echo($Inicio); ?>">Inicio</a> <span class="divider">/</span>
</li>
<li>
<a href="<?php echo($Ventas); ?>">Ventas</a> <span class="divider">/</span>
</li>
<li>
<a href="">Consulta Instaladores</a> <span class="divider">/</span>
</li>
<li class="active">Instalador - <?php echo($tecnico); ?> </li>
</ul>
</div>
</body>
</html>
FUNCION DE CONSULTA
Cita:
function VentaInstalador($instalador) {
$result = mysql_query("SELECT * FROM ventas WHERE instalador = $instalador ORDER BY fecha_venta DESC") or die(mysql_error());
return $result; }