3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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 } ?>
based on qGnYo
Output for 7.0.0 - 7.2.0
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.3.18 - 5.6.28
Fatal error: Class 'mysqli' not found in /in/ErSeU on line 19
Process exited with code 255.