Foros del Web » Programando para Internet » PHP »

en esta funcion solo me visualiza los campos con numeros y no con letras

Estas en el tema de en esta funcion solo me visualiza los campos con numeros y no con letras en el foro de PHP en Foros del Web. Código PHP: while( $salida  =  mysql_fetch_array ( $resultado )){      # escribimos un bucle que nos lea desde el indice 0 hasta el indice 6         # de la matriz de salida ya que los indices 0,1,2,3,4...         # se corresponden con el número de orden tal como fueron establecidos         # los campos en la opción SELECT: 0 es el indice del primero         # 1 el de segundo, 2 el del tercero, etc. etc.         for ( $i = 0 ; $i < 8 ; ...
  #1 (permalink)  
Antiguo 15/06/2004, 04:50
 
Fecha de Ingreso: junio-2004
Mensajes: 19
Antigüedad: 19 años, 9 meses
Puntos: 0
en esta funcion solo me visualiza los campos con numeros y no con letras

Código PHP:
while($salida mysql_fetch_array($resultado)){

    
# escribimos un bucle que nos lea desde el indice 0 hasta el indice 6
        # de la matriz de salida ya que los indices 0,1,2,3,4...
        # se corresponden con el número de orden tal como fueron establecidos
        # los campos en la opción SELECT: 0 es el indice del primero
        # 1 el de segundo, 2 el del tercero, etc. etc.

       
for ($i=0;$i<8;$i++){

# establecemos un condicion que escriba una tabla normal SALVO
# cuando $i=4 que es el valor actual de la puntuación
# cuando eso ocurre pedimos que escriba en la celda de la tabla
# un campo de formulario TIPO TEXTO cuyo NOMBRE SEA UNA MATRIZ
# aqui la hemos llamado ident
# cuyos indices sean los DNI de los personajes de la tabla
# recuerda que la $Salida[0] contiene siempre el primer elemento
# definido en la opcion SELECT y que en este caso es el DNI
# PEDIMOS QUE ESE CAMPO DEL FORM tenga por valor EL VALOR ACTUAL DE LA PUNTUACION
# existente en la base de DATOS


        
if($i=0)       
        echo 
"<td><input type=text size=8 name=ident[$salida[0]] value=$salida[0]></td><tr>";
       if(
$i=1)
            echo 
"<td><input type=text size=8 name=ident[$salida[1]] value=$salida[1]></td><tr>";
        if(
$i=2)
            echo 
"<td><input type=text size=8 name=ident[$salida[2]] value=$salida[2]></td><tr>";
    if(
$i=3)
            echo 
"<td><input type=text size=8 name=ident[$salida[3]] value=$salida[3]></td><tr>";
        if(
$i=4)
            echo 
"<td><input type=text size=8 name=ident[$salida[4]] value=$salida[4]></td><tr>";
        if(
$i=5)
            echo 
"<td><input type=text size=8 name=ident[$salida[5]] value=$salida[5]></td><tr>";
        if(
$i=6)
            echo 
"<td><input type=text size=8 name=ident[$salida[6]] value=$salida[6]></td><tr>";
        if(
$i=7)
            echo 
"<td><input type=text size=8 name=ident[$salida[7]] value=$salida[7]></td><tr>";
        if(
$i=8)
            echo 
"<td><input type=text size=8 name=ident[$salida[8]] value=$salida[8]></td><tr>"
  #2 (permalink)  
Antiguo 15/06/2004, 05:49
 
Fecha de Ingreso: junio-2004
Mensajes: 19
Antigüedad: 19 años, 9 meses
Puntos: 0
Hola amigos
tengo otro problemilla
que significa esto
Parse error: parse error, unexpected $end in C:\Archivos de programa\Apache Group\Apache2\htdocs\proyect\c1.php on line 65

viene de la siguiente funcion
Código PHP:
<html>


<?php
include (conex.phtml);
$busqueda=conectarse();

$DNI=$_GET['DNI'];

$busqueda="SELECT * FROM clientes WHERE DNI ='$DNI'";
$resultado_b=mysql_query($busqueda); 
if(
$row=mysql_fetch_row($resultado_b)) 

echo 
"

<form name=formulario method=post //action=modifica_registro.php//>
<input type=hidden name='DNI' value='$DNI'>

<table border='0' width='769' cellpadding='0' cellspacing='1' >
<input type='HIDDEN' name='id' value='$row[2]' size='10' maxlength='10'>

<tr>
<td width='92' bgcolor='#CCCCCC' height='21'><b>Socios</b></td>
<td width='568' height='21'></td>
</tr>
<tr>
<td width='92' height='28'>&nbsp;Nombre&nbsp;</td>
<td width='568' height='28'>&nbsp; <input type=text name='nombre'value='$row[0]' size='75' maxlength='25' ></td>
</tr>
<tr>
<td width='92' height='34'>&nbsp;Apellidos&nbsp;</td>
<td width='568' height='34'> &nbsp; <input type=text name='apellidos' value='$row[8]' size='75' maxlength='50'></td>
</tr>
<td width='92' height='34'>&nbsp;Telefono&nbsp;</td>
<td width='568' height='34'> &nbsp; <input type=text name='telefon' value='$row[1]' size='75' maxlength='50'></td>
</tr>
<tr>
<td width='92' height='34'>&nbsp;fecha de inscripcion&nbsp;</td>
<td width='568' height='34'>&nbsp; <input type=text name='fecha' value='$row[3]' size='6' maxlength='25'></td>
</tr>
<tr>
<td width='92' height='34'>&nbsp:Direccion:&nbsp</td>
<td width='568' height='34'>&nbsp; <input type=text name='direccion' size='5' maxlength='11' value='$row[4]'></td>
</tr>
<tr>
<td width='568' height='2'>&nbsp;email &nbsp;</td> 
<input type=text name='email' size='23' maxlength='35' value='$row[5]'>

<td width='92' height='2'>&nbsp;curso:</td> 
<input type=text name='curso' size='5' maxlength='11' value='$row[6]'>&nbsp;

<td width='92' height='2'>&nbsp;edad:</td> 
<input type=text name='curso' size='5' maxlength='11' value='$row[7]'>&nbsp;

<INPUT TYPE='submit' NAME='accion' VALUE='Devolucion libro'>
</td>
</tr>
</table>
</form>
"
;

?> 

</html>
  #3 (permalink)  
Antiguo 15/06/2004, 08:45
 
Fecha de Ingreso: junio-2004
Mensajes: 5
Antigüedad: 19 años, 9 meses
Puntos: 0
Ha la primera pregunta la funcion mysql_fetch_array() devuelve un array asociativo cuyo indices son los nombre de los campo de la tabla ej:
salida['nombre_campo'];
Para usar como indices numeros prueba con la funcion mysql_fetch_row()

----------------------------------------------------------------
Para la segunda duda prueba con esto.
<html>


<?
php
include (conex.phtml
);
$busqueda=conectarse
();

$DNI=$_GET['DNI'
];

$busqueda="SELECT * FROM clientes WHERE DNI ='$DNI'"
;
$resultado_b=mysql_query($busqueda
);
if(
$row=mysql_fetch_row($resultado_b
)) :?> /*fijate en los dos puntos y cierre el php*/
<form name=formulario method=post //action=modifica_registro.php//>
<input type=hidden name='DNI' value='$DNI'>

<table border='0' width='769' cellpadding='0' cellspacing='1' >
<input type='HIDDEN' name='id' value='$row
[2]
' size='10' maxlength='10'>

<tr>
<td width='92' bgcolor='#CCCCCC' height='21'><b>Socios</b></td>
<td width='568' height='21'></td>
</tr>
<tr>
<td width='92' height='28'>&nbsp;Nombre&nbsp;</td>
<td width='568' height='28'>&nbsp; <input type=text name='nombre'value='$row
[0]
' size='75' maxlength='25' ></td>
</tr>
<tr>
<td width='92' height='34'>&nbsp;Apellidos&nbsp;</td>
<td width='568' height='34'> &nbsp; <input type=text name='apellidos' value='$row
[8]
' size='75' maxlength='50'></td>
</tr>
<td width='92' height='34'>&nbsp;Telefono&nbsp;</td>
<td width='568' height='34'> &nbsp; <input type=text name='telefon' value='$row
[1]
' size='75' maxlength='50'></td>
</tr>
<tr>
<td width='92' height='34'>&nbsp;fecha de inscripcion&nbsp;</td>
<td width='568' height='34'>&nbsp; <input type=text name='fecha' value='$row
[3]
' size='6' maxlength='25'></td>
</tr>
<tr>
<td width='92' height='34'>&nbsp:Direccion:&nbsp</td>
<td width='568' height='34'>&nbsp; <input type=text name='direccion' size='5' maxlength='11' value='$row
[4]
'></td>
</tr>
<tr>
<td width='568' height='2'>&nbsp;email &nbsp;</td>
<input type=text name='email' size='23' maxlength='35' value='$row
[5]
'>

<td width='92' height='2'>&nbsp;curso:</td>
<input type=text name='curso' size='5' maxlength='11' value='$row
[6]
'>&nbsp;

<td width='92' height='2'>&nbsp;edad:</td>
<input type=text name='curso' size='5' maxlength='11' value='$row
[7]
'>&nbsp;

<INPUT TYPE='submit' NAME='accion' VALUE='Devolucion libro'>
</td>
</tr>
</table>
</form>

<? endif ;?> //cierra el if de esta forma

</html>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:06.