Note that there are some explanatory texts on larger screens.

plurals
  1. POReading 0 and 1 from a database and retrieving in a checkbox
    primarykey
    data
    text
    <p>I am trying to create a members table, using a PHPmyadmin database, and in the database, there is a 0 &amp; 1 field, and I want to transform the 0 and 1 in a checkbox, for each member. Is an editable table, so the table might be in a form. Here is what I did:</p> <pre><code>&lt;?php include('../../config.php'); $result2 = mysql_query("SELECT * FROM acars_users"); echo "&lt;table border='1'&gt; &lt;tr&gt; &lt;th&gt;ID&lt;/th&gt; &lt;th&gt;Dados Pessoais&lt;/th&gt; &lt;th&gt;Origem&lt;/th&gt; &lt;th&gt;Dados de Redes&lt;/th&gt; &lt;th width='220px'&gt;Base&lt;/th&gt; &lt;th&gt;Patente&lt;/th&gt; &lt;th&gt;Horas&lt;/th&gt; &lt;th&gt;&amp;Eacute; Ativo?&lt;/th&gt; &lt;th&gt;Dinheiro&lt;/th&gt; &lt;th&gt;Senha&lt;/th&gt; &lt;th&gt;Op&amp;ccedil;&amp;otilde;es&lt;/th&gt; &lt;/tr&gt;"; while($row = mysql_fetch_array($result2)) { echo "&lt;tr&gt;"; echo "&lt;td&gt;" . $row['id'] . "&lt;/td&gt;"; echo "&lt;td width='300px'&gt;" . "&lt;form action=editar.php method=POST&gt;&lt;input name=username size=7 type=text value=".$row['username']." /&gt;&lt;/br&gt;&lt;input name=nome size=10 type=text value=".$row['nome']." /&gt;&lt;input name=sobrenome size=20 type=text value=".$row['sobrenome']." /&gt;&lt;/br&gt;&lt;input name=email size=25 type=text value=".$row['email']." /&gt;" . "&lt;/td&gt;"; echo "&lt;td&gt;" . "&lt;input name=datanascimento size=10 type=text value=".$row['datanascimento']." /&gt;&lt;/br&gt;&lt;input name=pais size=10 type=text value=".$row['pais']." /&gt;&lt;/br&gt;&lt;input name=cidade size=30 type=text value=".$row['cidade']." /&gt;" . "&lt;/td&gt;"; echo "&lt;td&gt;" . "IVAO:&amp;nbsp;&lt;input name=idivao size=8 type=text value=".$row['idivao']." /&gt;&lt;/br&gt;VATSIM:&amp;nbsp;&lt;input name=idvatsim size=8 type=text value=".$row['idvatsim']." /&gt;" . "&lt;/td&gt;"; echo "&lt;td&gt;" . "&lt;input name=base size=8 type=text value=".$row['base']." /&gt;" . "&lt;/td&gt;"; echo "&lt;td&gt;" . "&lt;input name=rank size=10 type=text value=".$row['rank']." /&gt;&lt;/br&gt;Admin &amp;nbsp;&lt;input name=admin size=1 type=checkbox value=".$row['admin']." /&gt;&lt;/br&gt;DOV &amp;nbsp; &lt;input name=dov size=1 type=checkbox value=".$row['dov']." /&gt;&lt;/br&gt;Checador &amp;nbsp; &lt;input name=checador size=1 type=checkbox value=".$row['checador']." /&gt;" . "&lt;/td&gt;"; echo "&lt;td&gt;" . "&lt;input name=horas size=6 type=text value=".$row['horas']." /&gt;" . "&lt;/td&gt;"; echo "&lt;td&gt;" . "&lt;input type=checkbox name='isactive[]' value=".$row['isactive']." /&gt;" . "&lt;/td&gt;"; echo "&lt;td&gt;" . "&lt;input name=dinheiro size=10 type=text value=".$row['dinheiro']." /&gt;" . "&lt;/td&gt;"; echo "&lt;td&gt;" . "&lt;input name=password size=10 type=password value=".$row['password']." /&gt;" . "&lt;/td&gt;"; echo "&lt;td&gt;" . "&lt;input name=edit_id value=".$row['id']." type=hidden&gt;&lt;input type=submit value=Editar &gt;&lt;/form&gt;&lt;form action=deletarexist.php method=POST&gt;&lt;input name=delete_id value=".$row['id']." type=hidden&gt;&lt;input type=submit value=Demitir&gt;&lt;/form&gt;" . "&lt;/td&gt;"; echo "&lt;/tr&gt;"; } echo "&lt;/table&gt;"; ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload