Generate file with select + variable result

Asked

Viewed 22 times

0

I have basic knowledge in PHP and good in Mysql but I’m having a hard time I need to generate a select with a result, generate it on the screen where there will be a box to add quantity and after this list is marked generate a file with selections follows the code

<table>
<tr>
    <td bgcolor="#708090">Codigo</td>
    <td bgcolor="#708090">Nome</td>
    </tr>

<?php  
$conexao = mysql_connect("localhost", "root", "123456");
mysql_select_db("database") or die(mysql_error());

$sql = "SELECT codigo,nome FROM produto";//ORDER BY data DESC");
$dados = mysql_query($sql, $conexao);

while ($row = mysql_fetch_array($dados)) {
$codigo = $row[0];
$nome = $row[1];
//$classif = $row[2];
//$texto=$row[3];
//$linhas = mysql_num_rows($sql);

?>
<tr>
    <td bgcolor="#4682B4"><?php echo $codigo ?></td>
    <td bgcolor="#4682B4"><?php echo $nome ?></td>
    <td bgcolor="#4682B4"><center>[<input type="checkbox" name="<?php echo $classif ?>" value="<?php echo $classif ?>" >]</center></td>
    <td bgcolor="#4682B4"><center>[<input type="text" name="qtd" placeholder="quantidade">]
</tr>    
<?php
}
?>
  • this select ai brings all the record, you need to select from some id or similar in the database, something else. if you want to bring only one result pq is going through the entire list, SELECT code, name from product Where id=MEUID; this Where is meaningless.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.