0

please check my code in connecting with localhost (using phpmyadmin xampp)

<? php $username="root"; $password=""; $db="NSH"; $Name=$_POST['Name']; $conn=new mysqli($localhost,$username,$password,$db) or die("unable to connect"); $sql="insert into NSH('Name')"; values('$Name'); $query=mysqli_query($conn,$sql); if($query) { echo "Data inserted"; } else { echo "problem"; } ?> //I connected this with my html file(form)..using action and also method as post

21st May 2020, 3:45 AM
Nagilla Sri Harshini
1 ответ
0
$localhost is not defined . Do this $conn = mysqli_connect(localhost,"root","","NSH");
22nd May 2020, 11:07 AM
Vaibhav Dadhich
Vaibhav Dadhich - avatar