Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/06/2011, 14:33
Avatar de andreshenao
andreshenao
 
Fecha de Ingreso: enero-2009
Ubicación: Medellìn
Mensajes: 417
Antigüedad: 15 años, 3 meses
Puntos: 7
Error al cambiar de idioma

Un gran saludo para todos, tengo una dificultad en un sitio con muchas secciones pero solo en una me sale este error cuando le digo cambiar de idioma. "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 '' at line 1"
pero si oprimo nuevamente la banderita de ese idioma hay si funciona.
Pues he buscado por todos lados y no veo el error, si alguien me puede colaborar en que esta la falla le agradezco

Cita:
<?
session_start();
include 'master.php';

//$actual=actual();
$actual='products';
if(!$_SESSION['lang'])
{
$_SESSION['lang']='es';
}
$sql="select nombre_$_SESSION[lang] from categorias order by id";
$mysql=mysql_query($sql) or die(mysql_error());

while($data=mysql_fetch_array($mysql))
{
$datos[] = ($data[0]);
}
//xx

?>
Cita:
<div id="menu">
<? include "menu_$_SESSION[lang].php"?>
</div>
<div id="content_detail">


<div id="menu_prod">
<ul>
<?
$sql="select idsubcategoria from productos where id=$_GET[id]";
$mysql=mysql_query($sql) or die(mysql_error());
$idsubcat=mysql_result($mysql,0);

$sql="select idcategoria from subcategorias where id=$idsubcat";
$mysql=mysql_query($sql) or die(mysql_error());
$idcat=mysql_result($mysql,0);

$sql="select nombre_$_SESSION[lang],id,libro from subcategorias where idcategoria = $idcat order by id";
$mysql=mysql_query($sql) or die(mysql_error());

while($data=mysql_fetch_array($mysql))
{
echo "<li><a href=products.php?cat=$data[1]>$data[2]. $data[0]</a></li>";
}

?>
</ul>
</div>
<div id="map_nav">
<?
$sql="select nombre_$_SESSION[lang] from categorias where id=$idcat";
$mysql=mysql_query($sql) or die(mysql_error());
$nomcat=mysql_result($mysql,0);

$sql="select nombre_$_SESSION[lang], id from subcategorias where id=$idsubcat";
$mysql=mysql_query($sql) or die(mysql_error());
$datacat=mysql_fetch_array($mysql);

$sql="select * from productos where id = $_GET[id]";
$mysql=mysql_query($sql) or die(mysql_error());
$data=mysql_fetch_array($mysql);
$img = explode(" /",$data['nombre']);

echo "$nomcat / <a href='products.php?cat=$datacat[1]'>$datacat[0]</a> / $data[nombre]";
?>
</div>

<div id="detail_prod">
<?
$sql="select * from productos where id = $_GET[id]";
$mysql=mysql_query($sql) or die(mysql_error());
$data=mysql_fetch_array($mysql);
$img = explode(" /",$data['nombre']);

?>
<div id="prod">

<div id="big">
<img src="prod/<?=$img[0]?>/big.png" width="220" height="220" />

<?
$dir = opendir ("prod/$img[0]/montajes/");
$existe=false;

while ( false != ($file = readdir($dir) ) )
{
if (strpos($file, '.png',1) )
{
$i++;
?>
<div class="montaje">
<a href="prod/<?=$img[0]?>/montajes/big/<?=$i?>.png" rel="lightbox[gallery]">
<img src="prod/<?=$img[0]?>/montajes/<?=$i?>.png" width="57" height="57" border="0"/>
</a>
</div>
<?
}
}
closedir($dir);
?>
</div>

<div id="desc">
<?=$data['detalle_'.$_SESSION['lang']]?>
</div>

<div id="codigo">
<?=$data['nombre']?>
</div>

<div id="detalle">
<?=$data['descripcion_'.$_SESSION['lang']]?>
</div>
<div id="ref">
<? if (file_exists("prod/$img[0]/docs/dimensions.png")) :?>
<div class="element" style="width:80px;"><strong><a href="prod/<?=$img[0]?>/docs/dimensions.png" rel="lightbox[pic]">
<?
if($_SESSION['lang']=='es')
{
echo "Dimensiones";
}else
{
echo "Dimensions";
}
?>


</a></strong></div>
<? endif ?>
<? if (file_exists("prod/$img[0]/docs/selections.pdf")) :?>
<div class="element"><a href="prod/<?=$img[0]?>/docs/selections.pdf">
<?
if($_SESSION['lang']=='es')
{
echo "Selecci&oacute;n del modelo";
}else
{
echo "Model Selection";
}
?>
</a></div>
<? endif ?>
<? if (file_exists("prod/$img[0]/docs/engineering.jpg")) :?>
<div class="element"><a href="prod/<?=$img[0]?>/docs/engineering.jpg" rel="lightbox[img]">
<?
if($_SESSION['lang']=='es')
{
echo "Matriz de Selecci&oacute;n";
}else
{
echo "Selection Matriz";
}
?>

</a></div>
<? endif ?>
<? if (file_exists("prod/$img[0]/docs/technical.pdf")) :?>
<div class="element"><a href="prod/<?=$img[0]?>/docs/technical.pdf">
<?
if($_SESSION['lang']=='es')
{
echo "Ficha T&eacute;cnica<br />(Submitals)";
}else
{
echo "Submitals";
}
?>
</a></div>
<? endif ?>
</div>


</div>



</div>
De antemano gracias por la atencion
__________________
-----------------
Hosting Medellin
Diseño web medellin