function dbCreate($dbName) { global $db; if (!file_exists($dbName)) { // echo 'Creando bbdd...<br />'; $db = new SQLite3($dbName); chmod($dbName, 0777); // echo 'Creando tablas...<br />'; crearTablas(); } else { // echo 'La base de datos ya existe<br />'; $db = new SQLite3($dbName); } }
$res = $a * 2; echo " {$a}*2= {$res} <br />"; $res = $a * 3; echo " {$a}*3= {$res} <br />"; $res = $a * 4; echo " {$a}*4= {$res} <br />"; $res = $a * 5; echo " {$a}*5= {$res} <br />"; $res = $a * 6; echo " {$a}*6= {$res} <br />"; $res = $a * 7; echo " {$a}*7= {$res} <br />"; $res = $a * 8; echo "{$a}*8= {$res} <br />"; $res = $a * 9; echo " {$a}*9= {$res} <br />"; $res = $a * 10; echo "{$a}*10= {$res} <br />"; } echo "</td>"; echo "</tr>"; echo "</table>"; } while ($a < 10); break; } } $selct = $_POST['a']; crearTablas($selct); ?> </body> </html>
<?php include "conexion.php"; function crearBd() { $cnn = new conexion(); $con = $cnn->conectar(); $sql = "CREATE DATABASE formLogin"; if (mysqli_query($con, $sql)) { echo "consulta correcta"; } mysqli_close($con); } function crearTablas() { $cnn = new conexion(); $con = $cnn->conectar(); mysqli_select_db($con, "formLogin"); $sql = "CREATE TABLE usuarios(\n\tid INT(11) NOT NULL AUTO_INCREMENT,\n\tusuario CHAR(50),\n\tcontrasena CHAR(50),\n\tPRIMARY KEY(id)\n\t)"; if (mysqli_query($con, $sql)) { echo "tabla creada"; } mysqli_close($con); } crearBd(); crearTablas();