3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Ler dados enviados pelo formulario gerado if(isset($_POST["enviar"])){ foreach($_POST["checkbox"] as $key=>$value){ // echo "ID: " . $id . " Nome: " . $_POST["nome"][$id] . "<br/>"; echo $id_saida = mysql_real_escape_string($value); $tipo = mysql_real_escape_string($_POST['tipo_serv'][$key]); echo $nome = mysql_real_escape_string($_POST['nome'][$key]); $start = mysql_real_escape_string($_POST['start'][$key]); echo $valor = mysql_real_escape_string($_POST['valor'][$key]); $desconto = mysql_real_escape_string($_POST['desconto'][$key]); $tipo_veiculo = mysql_real_escape_string($_POST['tipo_veiculo'][$key]); } } // Conexao $mysqli = new mysqli("localhost", "root", "", "example"); ################### $id_transfer = ""; ################### $sql = "SELECT * FROM produtos where id_transfer = '$id_transfer' AND tipo_serv <> 'Regular'"; $form = null; if($query = mysqli_query($mysqli, $sql)){ $form .= "<table>"; while($linha = mysqli_fetch_object($query)){ // $form .= "({$linha->id}) <input type=\"checkbox\" name=\"checkbox[{$linha->id}]\" value=\"{$linha->id}\"/>{$linha->nome}<br/>"; // $form .= "<input type=\"hidden\" name=\"nome[{$linha->id}]\" value=\"{$linha->nome}\"/>"; ################################################################################################################################## $id_produtos = $linha['id_produtos']; $nome = $linha['nome']; $valor = $linha['valor']; $tipo_serv = $linha['tipo_serv']; $form .= "<td><input name=\"checkbox[{$id_produtos}]\" type=\"checkbox\" value=\"{$id_produtos}\"/></td>"; $form .= "<td>{$id_produtos}</td>"; $form .= "<td><input type=\"hidden\" name=\"nome[{$id_produtos}]\" value=\"{$nome}\" /></td>"; $form .= "<td><input type=\"hidden\" name=\"tipo_serv[{$id_produtos}]\" value=\"{$tipo_serv}\" /></td>"; $form .= "<td><input type=\"hidden\" name=\"valor[{$id_produtos}]\"value=\"{$valor}\" /></td>"; } $form .= "</table>"; // Montar o resto do formulário ?> <hr> <form method="POST" action=""> <!-- Resto !--> <?php echo $form; ?> <!-- Resto !--> <input type="submit" name="enviar" value="enviar"/> </form> <?php } ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Class "mysqli" not found in /in/ErSeU:19 Stack trace: #0 {main} thrown in /in/ErSeU on line 19
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught Error: Class 'mysqli' not found in /in/ErSeU:19 Stack trace: #0 {main} thrown in /in/ErSeU on line 19
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Fatal error: Class 'mysqli' not found in /in/ErSeU on line 19
Process exited with code 255.

preferences:
267.59 ms | 402 KiB | 385 Q