Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular

PHPize.online is a free online environment for quickly running, experimenting with and sharing PHP (including Carbon extension for DateTime) and SQL code. You can run your SQL code with PHP code that can use the same DB. For database manipulations you can use pre-defined instances of PDO ($pdo), mysqli ($mysqli) & Laravel query builder ($db)

Copy Format Clear
Copy Clear
Copy Format Clear
<?php $db = "CREATE DATABASE Mydb"; if($db){ echo "DATABASE CREATED SUCCESSFULLY"; } else{ echo "Failed to create a daatabase"; } $createTableQuery = "CREATE TABLE IF NOT EXISTS students ( id INT AUTO_INCREMENT PRIMARY KEY, stuID VARCHAR(10) UNIQUE NOT NULL, name VARCHAR(100) NOT NULL )"; if($createTableQuery){ echo "success"; } $sql = "SELECT id, name, email FROM students"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { echo "ID: " . $row["id"] . " - Name: " . $row["name"] . " - Email: " . $row["email"] . "<br>"; } } else { echo "No records found!"; } ?>
Show:  
Copy Clear