Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > PHP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #5  
Antiguo 20-08-2004
Avatar de Emilio
*Emilio* Emilio is offline
Capo
 
Registrado: may 2003
Ubicación: Palma de Mallorca
Posts: 2.639
Poder: 10
Emilio Va por buen camino
Te paso un pequeño ejemplo que puedes ver funcionando en http://www.clubdelphi.com/abm/ejemplo.php

El ejemplo no depende de ningún fichero adicional, puedes ver que ya incluye el Javascript y el css, sólo le falta que le hagas un formulario a la ventana de modificación de registro, a la cual le pasamos el id del registro por método GET, el fichero temp.php que se invoca en el enlace modificar no existe pero eso te será tarea fácil, fijate en la URL al pasar el ratón por encima de los enlaces modificar.

Código PHP:
<?
    mysql_connect
($host, $user, $pass) or die ("No puedo conectar al servidor.");
    
mysql_select_db("forodelphi") or die ("No puedo seleccionar la base de datos.");
    if ( 
$borrar !="" ) {
        
$sql_delete = "DELETE FROM thread where threadid = $borrar";
        
// mysql_query( $sql_delete ); Por tratarse de un ejemplo no ejecutamos esta línea
        
echo $sql_delete; // Mostramos lo que hubiesemos borrado.
    
}
    if ( 
$buscar=="" ) {
        
$sql = "SELECT * FROM thread where forumid<>32 order by threadid desc LIMIT 0, 20";
    }
    else {
        
$sql = "SELECT * FROM thread where forumid<>32  AND title like '%$buscar%' order by threadid desc LIMIT 0, 20";
    }
    
$result = mysql_query( $sql );
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><HEAD><TITLE>Club Delphi</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
</HEAD>
<style>
.lineas TD {
        BORDER-RIGHT: buttonshadow 1px solid;
        BORDER-TOP: buttonhighlight 1px solid;
        FONT: x-small Verdana, Arial, Helvetica, sans-serif;
        BORDER-LEFT: buttonhighlight 1px solid;
        BORDER-BOTTOM: buttonshadow 1px solid
}
.cabecera TD {
        BORDER-RIGHT: buttonshadow 1px solid;
        BORDER-TOP: buttonhighlight 1px solid;
        BACKGROUND: buttonface;
        FONT: x-small Verdana, Arial, Helvetica, sans-serif;
        BORDER-LEFT: buttonhighlight 1px solid;
        BORDER-BOTTOM: buttonshadow 1px solid
}
</style>
<script>
document.onkeydown = keyDown
function keyDown() {
    var keycode = event.keyCode
    if ( keycode==13 ) {
        document.form.submit();
    }
}
function ventana(fichero, nombre, w, h, scroll) {
    winl = (screen.width - w) / 2;
    wint = (screen.height - h) / 2;
    propiedades = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable';
    win = window.open( fichero, nombre, propiedades );
}
</script>
<BODY leftMargin="0" topMargin="0" marginheight="0 marginwidth="0" onload="document.form.buscar.focus()">
    <table class=cabecera border="0" cellpadding="0" cellspacing="0" width="100%">
        <form name="form" method="post" action="ejemplo.php">
        <tr>
            <td width="250">
                <B>Buscar</b>:&nbsp;<input name="buscar" type="text" id="buscar" value="<? echo $buscar; ?>" size="25">
            </td>
        </tr>
        </form>
    </table>
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="cabecera">
        <tr>
            <td width="60"><b>ID</b></td>
            <td><b>Título</b></td>
            <td width="125"><b>Modificar</b></td>
            <td width="125"><b>Borrar</b></td>
        </tr>
    </table>
    <?
    
while ($row = mysql_fetch_array($result)) {
        
?>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#DFDFDF">
        <tr class="lineas">
            <td width='60'> <? echo $row["threadid"]; ?>&nbsp;</td>
            <td> <? echo $row["title"]; ?>&nbsp;</td>
            <td width='125'>&nbsp;<a href="javascript:ventana('temp.php?id=<? echo $row["threadid"]; ?>','',600,400,true);">Modificar</a></td>
            <td width="125">&nbsp;<a href="ejemplo.php?borrar=<? echo $row["threadid"]; ?>">Borrar</a></td>
        </tr>
        </table>
        <?
    
}
    
?>
</BODY></HTML>
__________________
Saludos
Emilio
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 04:19:59.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi