Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    errore nella seconda query per recupero variabile

    ho chiesto aiuto nella sezione sql ma il problema adesso è che non riesco a recuperare la query in $stmtpersonale con variabile $row['user_nome']... qualche aiuto? grazie

    <div class="card-datatable table-responsive pt-0 p-3 w-100" >
    <table id="emp-table" class="datatables-basic table table-bordered p-3 w-100" width="100%">
    <thead>
    <tr><th>Cognome Nome</th>
    <th>Postazione</th>
    <th>Coordinatore</th>
    <th style="max-width:220px">Corso</th>
    <th>Tipo</th>
    <th>Ultimo corso</th>
    <th>Scadenza</th>
    <th></th><th></th>
    </tr>
    <tr><th>Cognome Nome </th>
    <th>Postazione</th>
    <th>Coordinatore</th>
    <th style="max-width:220px">Corso</th>
    <th>Tipo</th>
    <th>Ultimo corso</th>
    <th>Scadenza</th>
    <th></th><th></th>
    </tr>
    </thead>
    <tfoot>
    <tr><th>Cognome Nome </th>
    <th>Postazione</th>
    <th>Coordinatore</th>
    <th style="max-width:220px">Corso</th>
    <th>Tipo</th>
    <th>Ultimo corso</th>
    <th>Scadenza</th>
    <th></th><th></th>
    </tr>
    </tfoot>
    </thead>
    <tbody class="table-border-bottom-0" id="myTable">
    <?php $num = 0;
    include_once 'main.php';
    $stmt = $DB_con->prepare('SELECT * FROM vt_formaz_corsi ORDER BY user_nome ASC');
    $stmt->execute();
    $Count= $stmt->rowCount();
    if($stmt->rowCount() > 0)
    {
    while($row=$stmt->fetch(PDO::FETCH_ASSOC))
    {
    extract($row);

    ?><tr><td class="center"><?php echo $row['user_nome']; ?></td>

    <?php
    // this is the second query that not read
    $stmtpersonale = $DB_con->prepare("SELECT * FROM vt_personale as P INNER JOIN vt_formaz_corsi as C WHERE CONCAT_WS(P.user_cognome, ' ', P.user_nome) = '.(string)$row['user_nome'].'");


    $stmtpersonale->execute(); $Countpers= $stmtpersonale->rowCount();
    if($stmtpersonale->rowCount() > 0) {
    while($row4=$stmtpersonale->fetch(PDO::FETCH_ASSOC)){ extract($row4); ?>
    <td class="center"><?php echo $row4['user_postazione']; ?></td>
    <td class="center"><?php echo $row4['user_coordinatore']; ?></td>
    <?php } } ?>
    <td class="center p-3 w-100" style="width:50%"><?php echo $row['user_corso']; ?></td>
    <td class="center"><?php echo $row['user_residenziale']; ?></td>
    <td class="center"><?php echo $result; ?></td>


    <td class="center"> <?php echo $resultscadenza;?></td>
    <td class="center"> <?php echo $$differenza;?></td>



    </tr>

    <?php

    } }
    else
    {
    ?>
    <div class="col-xs-12">
    <div class="alert alert-warning">
    <span class="glyphicon glyphicon-info-sign"></span> &nbsp; Nessun dato trovato ...
    </div>
    </div>
    <?php
    }

    ?>
    <?php ob_end_flush();?>
    </tbody> </table> </div>

  2. #2
    Risolto così.. grazie comunque

    <?php
    $stmtpersonale = $DB_con->prepare("select d.* from vt_personale d INNER JOIN vt_formaz_corsi u on concat(d.user_cognome, ' ', d.user_nome)=u.user_nome WHERE u.user_nome='".(string)$row['user_nome']."'");
    $stmtpersonale->execute();
    $rs = $stmtpersonale->fetch(PDO::FETCH_ASSOC);
    ?>

Tag per questa discussione

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.