+ 6
How to make a contact form database?
I have tried but I couldn't bcz I didn't learn yet php. I had created database and table but I couldn't connect. I had collect some code and edited: https://code.sololearn.com/wD22XwjqhHqT/?ref=app
8 Respostas
+ 2
Follow Following steps.
1. Start the server
2. Create New Database and table using phpmyadmin
http://localhost/phpmyadmin
3. Connect MySQL in PHP code
<?php
$servername = "localhost";
$username = "username";
$password = "password";
// Create connection
$conn = new mysqli($servername, $username, $password);
?>
4. Get form value and run insert query in php code.
$sql = "INSERT INTO table_name (name, email, phone) VALUES ('Lokesh', 'glokesh94@gmail.com', '8764335768')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
+ 5
Thanks bro
+ 4
Thank you
+ 4
I had created in this way.
I am success but it's so simple I didn't khow. 😃
+ 2
🌳Azim🐝 Hello there, you can not connect the database here on SoloLearn. Nevertheless, you can make a local server on your phone.
How to install a local server?
I am assuming, you are working with an Android phone.
1) So, go to play store and search for the app 'Penguin Server Apk', download and install it.
2) Start the server
3) Go to phpmyadmin, create a database and get the username and password
4) Then write the same php code in your phone with an editor and run it.
If you can do all the steps correctly, you will be able to connect the database :))
+ 2
Let me know if you could successfully do it :))
+ 1
You cannot connect because SoloLearn don't have database support for the code playground in PHP if I remember correctly
+ 1
Ok! Bro.