0
how can i connect to my database using php after i created a html form ?
10 Antworten
+ 1
I assume you already set up XAMPP or whatever you using,then start with this
//If you use localhost
<?php
$servername = "localhost";
$username = "root";
$password = "";
$database ="your_db_name";
// Create connection
$conn = mysqli_connect($servername, $username, $password,$database);
?>
+ 1
in HTML file u need to mention path of the PHP file
+ 1
with Mysqli api!😊
+ 1
i've use wampserver to create my database. but the problem is when i post datas via my html form, i don't recover them in the database
+ 1
is there anybody there ?
+ 1
ok tank you i'll try it
0
Maybe post your code?
0
here is my code
<?php
mysql_connect ("192.168.56.1", "root", " ");
mysql_sélect_db("cenajes");
$prenom ($_post['prenom']);
$nom ($_post['nom']);
$matricule ($_post['matricule']);
if (
isset ($_post['prenom'])
and isset ($_post['nom'])
and isset ($_post['matricule'])
)
{
$sql=$bdd_QUERY (insert into FORM values (" ", ".$prenom.", ".$nom.","$.matricule.")
}
?>
0
Try to print info you get via form,if it dont work then form is problem,if it work you didnt setup database well just follow any youtube tutorial and later try it by yourself
0
Also in your code, you wrote "select" with that ' on e maybe its problen