Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Is there an option to access MYSQL from PHP?

0 votes
asked Oct 3, 2018 by anonymous

This tool is great. However without an option to connect to MYSQL or any other DB from PHP, there is very less value add for me at least?

Do we have that option to connect to a DB from PHP?



1 Answer

0 votes
answered Nov 16, 2019 by yashwanth gajji (140 points)

Yes We can connect to Database in PHP

$servername = "localhost";
$username = "username";
$password = "password";
// Create connection
$conn = mysqli_connect($servername, $username, $password);
// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
echo "Connected successfully";

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.