Page 1 of 1

SOLVED checkbox database

Posted: Mon Feb 16, 2009 3:38 am
by Plata
hi,

For this moment, i try to recover a value from a database MySQL to put it next to a checkbox ; Typically the checkbox space value of database.
But actually i don't arrive to display the value of the database :

Code: Select all

//l'utilisateur connecté accéde à la liste des thémes disponibles sur le site
$req_affichage_themes = "select titre from theme_langue where theme_langue.id_langue=".$_SESSION['id_langue']." ";
 
//execution
$res_req_affichage_themes = sql_requete($req_affichage_themes);
 
//traditional way of display in my application
echo($res_req_affichage_themes[0]['titre']);
 
for ($i = 1 ; $i = $nb_elmts_res_req_affichage_themes ; $i++)
{
    ?>  <!-- affichage à tester -->
      [b] [u] <input type="checkbox" name="theme" value="<?php echo($res_req_affichage_themes[1]['titre'])   ?>"<br>[/u][/b]
    <?php
}
 
 
 
Can anyone help me?

see u :)

Re: checkbox database

Posted: Mon Feb 16, 2009 4:22 am
by Plata
in fact, i arrive to display the records one by one but not inside the loop for all the elements

Code: Select all

[b][i]for ($i = 0; $i <=  $nb_elmts_res_req_affichage_themes ; $i++)[/i][/b]
{
    ?>  <!-- affichage à tester -->
        <input type="checkbox" name="theme" value="theme_value"> <?php echo("hey !!!".[i][u]$res_req_affichage_themes[i]['titre'][/u]) [/i]?> <br>
    <?php
}
    ?>
can you advice me?

see u :)

Re: checkbox database

Posted: Mon Feb 16, 2009 4:34 am
by Plata
ok i resolved the tricky thing
--- i forgot the $ at i---

Code: Select all

for ($i = 0;[u] $i <=  $nb_elmts_res_req_affichage_themes[/u] ; $i++)
{
    ?>  <!-- affichage à tester -->
        <input type="checkbox" name="theme" value="theme_value"> <?php echo($res_req_affichage_themes[[b][u]$i[/u][/b]]['titre']) ?> <br>
    <?php
}
    ?>

how do i put "resolved" in the forum?

Plata