Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/09/2010, 08:12
thehack
 
Fecha de Ingreso: abril-2010
Mensajes: 151
Antigüedad: 14 años
Puntos: 1
De acuerdo Ayuda aca por favor

Hola que tal alguien que me pueda ayudar con conocimiento al php

Quisiera saber como hacer filtrados a la base de datos con un Where

eje: tengo una tabla dentro de una base de datos se llama (tcontribuyente)

donde se registra un contribuyente con nombre apellido cedula si es extrangero o de su nacionalidad. Hasta aqui voy bien.

El problema es lo siguiente hago esto en un formulario donde registro un Comercio
que tiene la tabla (tcomercio) se registra el comercio el contribuyente ciudad localidad etc etc.

donde el formulario es el siguiente

Código PHP:
<?php require_once "procesos.php"?>
<br>
<H3 align="center">
    <strong>Administracion de RecCom
    </strong>
</H3>
<form name="f1">
    <table border="1" width="420px" align="CENTER" bordercolor="" > 
        
                <input  type="hidden" name="kRecCom" maxlength="36" size="36"onChange="validarRecCom()" value="<?php $acceso->objeto->ejecutarSql("select * from reccom ORDER BY kreccom desc"); echo "COD".verCo($acceso,"kreccom")?>">
            
        <tr>
            <td>
                <span class="fuente">Contribuyentes
                </span>
            </td>
            <td>
                <select name="kContribuyente" id="-1" onchange="">
                    <?php echo contribuyentes($acceso)?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <span class="fuente">Sectores
                </span>
            </td>
            <td>
                <select name="kSector" id="-1" onchange="">
                    <?php echo sectores($acceso)?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <span class="fuente">Zonas
                </span>
            </td>
            <td>
                <select name="kZona" id="-1" onchange="">
                    <?php echo zonas($acceso)?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <span class="fuente">Comercios
                </span>
            </td>
            <td>
                <select name="kComercio" id="-1" onchange="">
                    <?php echo comercios($acceso)?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <span class="fuente">Tarifas
                </span>
            </td>
            <td>
                <select name="kTarifa" id="-1" onchange="">
                    <?php echo tarifas($acceso)?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <span class="fuente">Tenencias
                </span>
            </td>
            <td>
                <select name="kTenencia" id="-1" onchange="">
                    <?php echo tenencias($acceso)?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <span class="fuente">Cuentas
                </span>
            </td>
            <td>
                <select name="kCuenta" id="-1" onchange="">
                    <?php echo cuentas($acceso)?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <span class="fuente">Usos
                </span>
            </td>
            <td>
                <select name="kUso" id="-1" onchange="">
                <?php echo usos($acceso)?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <span class="fuente">Estado del Recibo
                </span>
            </td>
            <td>
                <select name="kEstRec" id="-1" onchange="">
                    <?php echo recibo($acceso)?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <span class="fuente">Empleado
                </span>
            </td>
            <td>
                <select name="kEmp" id="-1" onchange="">
                    <?php echo empleados($acceso)?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <span class="fuente">Convenios
                </span>
            </td>
            <td>
                <select name="kConvenio" id="-1" onchange="">
                    <?php echo convenios($acceso)?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <span class="fuente">Fecha Recibo Comercio
                </span>
            </td>
            <td>
                <input  type="text" name="fFecRecCom" id="fFecRecCom" maxlength="10" size="30" value="<?php echo date("d/m/Y");?>" >
            </td>
        </tr>
        <tr>
            <td>
                <span class="fuente">Fecha Pago Comercio
                </span>
            </td>
            <td>
                <input  type="text" name="fFecPagCom" id="fFecPagCom" maxlength="10" size="30" value="<?php echo date("d/m/Y");?>" >
            </td>
        </tr>
        <tr>
            <td>
                <span class="fuente">Observacion Recibo
                </span>
            </td>
            <td>
            <textarea name="mObsRecCom" style="height:300px;width:550px;" onfocus="foco(this);" onblur="no_foco(this);"></textarea>
                
            </td>
        </tr>
        <input  type="hidden" value="dato" name="dato">
        <tr>
            <td colspan="2" rowspan="1">
                <br>
                <div align="center">
                    <input  type="button" name="registrar" value="REGISTRAR" onclick="verificar('incluir','RecCom')">&nbsp;
                    <input  type="button" name="modificar" value="MODIFICAR" onclick="verificar('modificar','RecCom')">&nbsp;
                    <input  type="button" name="eliminar" value="ELIMINAR" onclick="verificar('eliminar','RecCom')">&nbsp;
                    <input  type="reset" name="Resetear" value="CANCELAR">
                </div>
            </td>
        </tr>
        <tr>            
            <td colspan="2">                
                <div id="datagrid" class="data">
                </div>            
            </td>        
        </tr>
    </table>
</form>

donde esta la parte

Código PHP:
<select name="kContribuyente" id="-1" onchange="">
                    <?php echo contribuyentes($acceso)?>
                </select>
tiene esta funcion

Código PHP:
function contribuyentes($acceso){
    
$cad=opcion(0,"Selecciones...");
    
$acceso->objeto->ejecutarSql(sql("
    
    tcontribuyente"
));
    while (
$row=row($acceso))
    {
        
$cad=$cad.opcion($row["kcontribuyente"],$row["cnomctrb"]);        
    }                                
    return 
$cad;    


lo cual quiero hacer el select en la function contribuyentes a travez de un where
que cuando la persona elija a xxx persona automaticamente aparezca

si esta persona tiene comercio y cuantos ejemplo dentro de este

Código PHP:
<select name="kComercio" id="-1" onchange="">
                    <?php echo comercios($acceso)?>
                </select>
select micomercio1,comercio2,comercio3, etc, etc asi pero no se como hacerlo quien pueda ayudarme se lo agradezco