how can i connect to my database using php after i created a html form ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how can i connect to my database using php after i created a html form ?

22nd Oct 2016, 10:58 PM
Mainankaye Evele
Mainankaye Evele - avatar
10 Answers
+ 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); ?>
22nd Oct 2016, 11:16 PM
Аца Србија
Аца Србија - avatar
+ 1
in HTML file u need to mention path of the PHP file
23rd Oct 2016, 2:31 AM
Kartik Bhat
Kartik Bhat - avatar
+ 1
with Mysqli api!😊
23rd Oct 2016, 3:41 AM
babakm
babakm - avatar
+ 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
23rd Oct 2016, 8:29 AM
Mainankaye Evele
Mainankaye Evele - avatar
+ 1
is there anybody there ?
4th Nov 2016, 12:33 PM
Mainankaye Evele
Mainankaye Evele - avatar
+ 1
ok tank you i'll try it
4th Nov 2016, 12:44 PM
Mainankaye Evele
Mainankaye Evele - avatar
0
Maybe post your code?
23rd Oct 2016, 9:40 AM
Аца Србија
Аца Србија - avatar
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.") } ?>
24th Oct 2016, 12:48 PM
Mainankaye Evele
Mainankaye Evele - avatar
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
4th Nov 2016, 12:37 PM
Аца Србија
Аца Србија - avatar
0
Also in your code, you wrote "select" with that ' on e maybe its problen
4th Nov 2016, 12:38 PM
Аца Србија
Аца Србија - avatar