Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "xxx.xxx.x.xx";
- $username = "xxxxx";
- $password = "xxxxxxx";
- $dbname = "xxxxxx";
- $conn = new mysqli($servername, $username, $password, $dbname);
- $conn->set_charset('utf8');
- if(isset($_POST['consulta1']))
- {
- $result_cursos = "SELECT centrodb.RegistoManutencao.Id,
- DataRegisto,
- Pedido,
- Outro,
- Descricao,
- Funcionario,
- Imagem,
- Tratamento,
- Estado
- FROM centrodb.RegistoManutencao LEFT OUTER JOIN centrodb.InfoLuvas
- ON centrodb.InfoLuvas.Id = centrodb.RegistoManutencao.Colaborador
- WHERE Estado IS NULL;";
- $resultado_cursos = mysqli_query($conn, $result_cursos);
- $tabela1 .= '<div style="float: center" table align="center">';
- $tabela1 .= '<table border="5">';
- $tabela1 .= '<tr>';
- $tabela1 .='<thead>';
- $tabela1 .= '<tr>';
- $tabela1 .= '<th>Nº Registo</th>';
- $tabela1 .= '<th>Data</th>';
- $tabela1 .= '<th>Pedido</th>';
- $tabela1 .= '<th>Outro Local</th>';
- $tabela1 .= '<th>Descrição</th>';
- $tabela1 .= '<th>Colaborador</th>';
- $tabela1 .= '<th>Imagem</th>';
- $tabela1 .= '<th>Tratamento</th>';
- $tabela1 .= '<th>Concluído</th>';
- $tabela1 .= '</tr>';
- $tabela1 .='</thead>';
- $tabela1 .='<tbody>';
- while($rows_cursos = mysqli_fetch_array($resultado_cursos)) {
- $tabela1 .= '<tr>';
- $tabela1 .= '<td>'.$rows_cursos['Id'].'</td>';
- $tabela1 .= '<td>'.$rows_cursos['DataRegisto'].'</td>';
- $tabela1 .= '<td>'.$rows_cursos['Pedido'].'</td>';
- $tabela1 .= '<td>'.$rows_cursos['Outro'].'</td>';
- $tabela1 .= '<td>'.$rows_cursos['Descricao'].'</td>';
- $tabela1 .= '<td>'.$rows_cursos['Funcionario'].'</td>';
- $tabela1 .= '<td> <input type="file" name= "Imagem" id= "Imagem" value="'.$rows_cursos['Imagem'].'"></td>';
- $tabela1 .= '<td> <input type="text" name= "Tratamento" id= "Tratamento" value="'.$rows_cursos['Tratamento'].'"></td>';
- $tabela1 .= '<td> <input type="checkbox" name= "Id[]" value="'.$rows_cursos['Id'].'"></td>';
- $tabela1 .= '</tr>';
- }}
- $tabela1 .= '</tr>';
- $tabela1 .='</tbody>';
- $tabela1 .= '</table>';
- $tabela1 .= '</div>';
- echo "<form method='POST' action=''>";
- echo $tabela1;
- echo "<input type='submit' name='registar' value='Registo'>";
- echo "</form>";
- ?>
- <?php
- if(isset($_POST['registar']))
- {
- $servername = "192.168.0.26";
- $username = "centro";
- $password = "qQQ!000p";
- $dbname = "centrodb";
- $conn = new mysqli($servername, $username, $password, $dbname);
- $conn->set_charset('utf8');
- $registro = $_POST['Id'];
- $tratamento = $_POST['Tratamento'];
- $imagem = $_POST['Imagem'];
- foreach($registro as $value) {
- $conn->query("UPDATE RegistoManutencao SET Estado = 'Concluido', Tratamento = '$tratamento', Imagem = '$imagem' WHERE Id=" . $value);
- }
- }
- ?>
Add Comment
Please, Sign In to add comment