Ver Mensaje Individual
  #7 (permalink)  
Antiguo 28/02/2010, 12:05
mig5ueles
 
Fecha de Ingreso: mayo-2008
Mensajes: 24
Antigüedad: 16 años
Puntos: 0
Respuesta: Parametros a otra funcion?

<?php
//importando nuestras las referencias XAJAX
require_once ("index.common.php");


//función tablacoor.
function ListarTablaCoor(){

$db=mysql_connect('localhost','root','');
mysql_select_db('DB',$db);

$objResponse = new xajaxResponse();
//instanciamos el objeto para la respuesta AJAX
//ISO-8859-1 significa que los caracteres latinos como la ñ y los acentos seran tomados en cuenta

$rsDatos=mysql_query("select * from map_coor_1",$db);
$cantRegistros=mysql_num_rows($rsDatos);

$tabla=''; //variable donde guardaremos la tabla HTML que luego se mostrara mediante AJAX

if($cantRegistros>0){ // Si existen registros entonces armamos la cabecera de la tabla
$tabla='<table border="1">
<tr>
<td height="76" width="92">NUMERO</td>
<td height="76" width="92">A</td>
<td height="76" width="92">B</td>
<td height="76" width="92">C</td>
<td height="76" width="92">D</td>
<td height="76" width="92">E</td>
</tr>';
while($row=mysql_fetch_row($rsDatos)){ //recorriendo registro x registro y armando la tabla


$res1= $row[1];
$res2= $row[2];
$res3= $row[3];
$res4= $row[4];
$res5= $row[5];

if ($res1==''){
$res1 = "_";
}else{
$rsFicha=mysql_query("select imagen from ejer_ficha where idficha = $row[1]",$db);
$row_ficha=mysql_fetch_row($rsFicha);

$columna= 'A';
$res1 = "<a href= '#'><img src='images/".$row_ficha[0]."' width='70' height='70' onclick='xajax_ClickFicha(".$columna.",".$res1.")'/></a>";

}

if ($res2==''){
$res2 = "_";
}else{
$rsFicha=mysql_query("select imagen from ejer_ficha where idficha = '$row[2]'",$db);
$row_ficha=mysql_fetch_row($rsFicha);

$columna= 'B';
$res2 = "<img src='images/".$row_ficha[1]."' width='70' height='70' onclick='xajax_ClickFicha($columna,$res2)' />";
}

if ($res3==''){
$res3 = "_";
}else{
$rsFicha=mysql_query("select imagen from ejer_ficha where idficha = $row[3]",$db);
$row_ficha=mysql_fetch_row($rsFicha);

$columna= 'C';
$res3 = "<img src='images/".$row_ficha[2]."' width='70' height='70' onclick='xajax_ClickFicha($columna,$res3)' />";

}

if ($res4==''){
$res4 = "_";
}else{
$rsFicha=mysql_query("select imagen from ejer_ficha where idficha = $row[4]",$db);
$row_ficha=mysql_fetch_row($rsFicha);

$columna= 'D';
$res4 = "<img src='images/".$row_ficha[3]."' width='70' height='70' onclick='xajax_ClickFicha($columna,$res4)' />";
}

if ($res5==''){
$res5 = "_";
}else{
$rsFicha=mysql_query("select imagen from ejer_ficha where idficha = $row[5]",$db);
$row_ficha=mysql_fetch_row($rsFicha);

$columna= 'E';
$res5 = "<img src='images/".$row_ficha[4]."' width='70' height='70' onclick='xajax_ClickFicha($columna,$res5)' />";
}

$tabla.='<tr>
<td height="76" width="92">'.$row[0].'</td>
<td height="76" width="92">'.$res1.'</td>
<td height="76" width="92">'.$res2.'</td>
<td height="76" width="92">'.$res3.'</td>
<td height="76" width="92">'.$res4.'</td>
<td height="76" width="92">'.$res5.'</td>
</tr>';
}
$tabla.='</table>';
}
//asignando el contenido de la varabiale $tabla al div que esta en index.php
//innerHTML reemplaza el contenido HTML por otro
$objResponse->assign("divListado","innerHTML",$tabla);
//mostramos un alert
// $objResponse->alert("Este ciclo tiene ".$cantRegistros." cursos.");
return $objResponse; //retornamos la respuesta AJAX
}




//funcion clickficha
function ClickFicha($col,$fil){

echo "$col";
echo "$fil";

$db=mysql_connect('localhost','root','');
mysql_select_db('DB',$db);

$objResponse = new xajaxResponse();
//instanciamos el objeto para la respuesta AJAX
//ISO-8859-1 significa que los caracteres latinos como la ñ y los acentos seran tomados en cuenta

$rsDatos=mysql_query("select * from map_coor_1",$db);
$cantRegistros=mysql_num_rows($rsDatos);

$tabla=''; //variable donde guardaremos la tabla HTML que luego se mostrara mediante AJAX

if($cantRegistros>0){ // Si existen registros entonces armamos la cabecera de la tabla
$tabla='<table border="1">
<tr>
<td height="76" width="92">NUMERO</td>
<td height="76" width="92">A</td>
<td height="76" width="92">B</td>
<td height="76" width="92">C</td>
<td height="76" width="92">D</td>
<td height="76" width="92">E</td>
</tr>';
while($row=mysql_fetch_row($rsDatos)){ //recorriendo registro x registro y armando la tabla


$res1= $row[1];
$res2= $row[2];
$res3= $row[3];
$res4= $row[4];
$res5= $row[5];

if ($res1==''){
$res1 = "_";
}else{
$rsFicha=mysql_query("select imagen from ejer_ficha where idficha = $row[1]",$db);
$row_ficha=mysql_fetch_row($rsFicha);

$columna= 'A';
$res1 = "<img src='images/".$row_ficha[0]."' width='70' height='70' onclick='xajax_ClickFicha($columna,$res1)'/>";
}

if ($res2==''){
$res2 = "_";
}else{
$rsFicha=mysql_query("select imagen from ejer_ficha where idficha = '$row[2]'",$db);
$row_ficha=mysql_fetch_row($rsFicha);

$columna= 'B';
$res2 = "<img src='images/".$row_ficha[1]."' width='70' height='70' onclick='xajax_ClickFicha($columna,$res2)' />";
}

if ($res3==''){
$res3 = "_";
}else{
$rsFicha=mysql_query("select imagen from ejer_ficha where idficha = $row[3]",$db);
$row_ficha=mysql_fetch_row($rsFicha);

$columna= 'C';
$res3 = "<img src='images/".$row_ficha[2]."' width='70' height='70' onclick='xajax_ClickFicha($columna,$res3)' />";

}

if ($res4==''){
$res4 = "_";
}else{
$rsFicha=mysql_query("select imagen from ejer_ficha where idficha = $row[4]",$db);
$row_ficha=mysql_fetch_row($rsFicha);

$columna= 'D';
$res4 = "<img src='images/".$row_ficha[3]."' width='70' height='70' onclick='xajax_ClickFicha($columna,$res4)' />";
}

if ($res5==''){
$res5 = "_";
}else{
$rsFicha=mysql_query("select imagen from ejer_ficha where idficha = $row[5]",$db);
$row_ficha=mysql_fetch_row($rsFicha);

$columna= 'E';
$res5 = "<img src='images/".$row_ficha[4]."' width='70' height='70' onclick='xajax_ClickFicha($columna,$res5)' />";
}

$tabla.='<tr>
<td height="76" width="92">'.$row[0].'</td>
<td height="76" width="92">'.$res1.'</td>
<td height="76" width="92">'.$res2.'</td>
<td height="76" width="92">'.$res3.'</td>
<td height="76" width="92">'.$res4.'</td>
<td height="76" width="92">'.$res5.'</td>
</tr>';
}
$tabla.='</table>';
}
//asignando el contenido de la varabiale $tabla al div que esta en index.php
//innerHTML reemplaza el contenido HTML por otro
$objResponse->assign("divListado","innerHTML",$tabla);
//mostramos un alert
// $objResponse->alert("Este ciclo tiene ".$cantRegistros." cursos.");
return $objResponse; //retornamos la respuesta AJAX
}

//procesando cualquier petición AJAX
$xajax->processRequest();


?>