Selection line of a PHP / HTML table

Selection line of a PHP / HTML table

vinkey33vinkey33 Posts: 7Questions: 4Answers: 0
edited November 2016 in Free community support

Hello,
So I fill in an HTML table using PHP, I would like the power to select an entire row, ie retrieve a row from the array for inserted in the entry corresponding to the column name. Possible? If so in PHP? In JavaScript? Other?
J 'started in php here is the code that I realized but the worry is that I take a cell judged so I am all in line distributed on several entry

code php & html:
<?php require_once "PDO_connect.php";

$query="SELECT * FROM smartphone.abonnements";
try{
$prep = $bdd->prepare($query);
$prep->execute();
$resultats = $prep->fetchAll();

}catch(Exception $e){;
echo "Erreur ! ".$e->getMessage() ;
}
$host = "localhost";
$user = "root";
$pass = "Mm101010";
$dbn = "smartphone";
$link = mysqli_connect($host, $user, $pass, $dbn);

<?php > <!DOCTYPE> Abonnement .selline { background-color: silver;}

Abonnements




<?php echo "<br>"; if(!empty($resultats)){ foreach ($resultats as $row) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } }else { echo "Pas d'enregistrements dans cette table..."; } ?>
Operateur SIM PUK Num ligne Volume Statut abo
".$row["Operateur"]."".$row["Num_SIM"]."".$row["PUK"]."".$row["Num_ligne"]."".$row["Volume"]."".$row["Statut_abo"]."


<?php $query = "SELECT USER_ID, Nom, Num_SIM, Num_ligne FROM select_nom_prenom_user ORDER BY Nom, Num_SIM, Num_ligne ASC"; if($result = mysqli_query($link, $query)); { echo'<select name="select_nom_prenom_user">'; echo'Selectionnée Nom/Num SIM/Num ligne'; while ($idresult = mysqli_fetch_row($result)) { $USER_ID = $idresult[0]; $Nom = $idresult[1]; $Num_SIM = $idresult[2]; $Num_ligne = $idresult[3]; echo'' . $Nom . ' ' . $Num_SIM . ' ' . $Num_ligne . ''; } echo'

'; } ?>

Operateur :
Num SIM : PUK : Num ligne : Volume : Statut Abo : ?>

code js:
function getTrValues(e){
var el=e.target.parentNode
if(el.cells && el.parentNode.rows[0]!=el){
var all=document.getElementById('saisie').getElementsByTagName("input")
var cells = el.cells
var cellcount = cells.length;
for( c=0; c<cellcount; c++) {
all[c].value=cells[c].innerHTML
}
}
}
thank

Answers

  • WebCodexWebCodex Posts: 71Questions: 13Answers: 3

    Please format the code into a readable way so others may assist you, thanks

  • vinkey33vinkey33 Posts: 7Questions: 4Answers: 0

    Code php et html:
    `<?php require_once "PDO_connect.php";

    $query="SELECT * FROM smartphone.abonnements";
    try{
    $prep = $bdd->prepare($query);
    $prep->execute();
    $resultats = $prep->fetchAll();

    }catch(Exception $e){;
    echo "Erreur ! ".$e->getMessage() ;
    }
    $host = "localhost";
    $user = "root";
    $pass = "Mm101010";
    $dbn = "smartphone";
    $link = mysqli_connect($host, $user, $pass, $dbn);

    <?php > <!DOCTYPE> Abonnement .selline { background-color: silver;}

    Abonnements




    <?php echo "<br>"; if(!empty($resultats)){ foreach ($resultats as $row) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } }else { echo "Pas d'enregistrements dans cette table..."; } ?>
    Operateur SIM PUK Num ligne Volume Statut abo
    ".$row["Operateur"]."".$row["Num_SIM"]."".$row["PUK"]."".$row["Num_ligne"]."".$row["Volume"]."".$row["Statut_abo"]."


    <?php $query = "SELECT USER_ID, Nom, Num_SIM, Num_ligne FROM select_nom_prenom_user ORDER BY Nom, Num_SIM, Num_ligne ASC"; if($result = mysqli_query($link, $query)); { echo'<select name="select_nom_prenom_user">'; echo'Selectionnée Nom/Num SIM/Num ligne'; while ($idresult = mysqli_fetch_row($result)) { $USER_ID = $idresult[0]; $Nom = $idresult[1]; $Num_SIM = $idresult[2]; $Num_ligne = $idresult[3]; echo'' . $Nom . ' ' . $Num_SIM . ' ' . $Num_ligne . ''; } echo'

    '; } ?>

    Operateur :
    Num SIM : PUK : Num ligne : Volume : Statut Abo : ` ?>
  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Please format your code using Markdown.
    https://datatables.net/manual/tech-notes/8
    Also your original question is very difficult to understand. Can you explain it better?

This discussion has been closed.