|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-10-31 14:03 UTC] kalle@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Fri Jun 19 00:00:02 2026 UTC |
Description: ------------ Intent? poner esta nota: funcion gen?rica para crear una tabla con cualquier SELECT, la hice como herramienta de depuraci?n <?PHP function ver_tabla($con,$pega,$ver=0,$largo=100){ /* $con= consulta $pega= identificador de conexi?n $ver= mostrar el contenido de la consulta $largo=carateres en la columna */ $tabla=" <!--Generado con el script ver_tabla.Consulta:\n". $con."\n -->\n "; if($ver){$tabla.="<pre>".$con."</pre>";} $res=mysql_query($con,$pega); $t_c=mysql_num_fields($res); $tabla.= mysql_num_rows($res). " registros\n" ; $tabla.= "<table border=\"1\">\n<tr>"; for($x=0; $x<$t_c; $x++){ $t=mysql_field_name($res, $x); $tabla.="\t<th title=\" ".$t." \" >".substr($t,0,$largo)."</th>\n"; } $tabla.="</tr>\n"; while ($fila = mysql_fetch_array($res)){ $tabla.="\t<tr>\n"; for($x=0; $x<$t_c; $x++){ if(!($fila[$x]{0})){$fila[$x]="?";} $tabla.="\t<td title=\" ".$fila[$x]." \" >".substr($fila[$x],0,$largo)."</td>\n"; } $tabla.="</tr>\n"; } $tabla.="</table>"; return $tabla; } ?> Reproduce code: --------------- --- From manual page: function.mysql-num-fields --- Expected result: ---------------- Gracias!! Actual result: -------------- There was an internal error processing your submission. Please try to submit again later.