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
1 Antwort
0
$localhost is not defined .
Do this $conn = mysqli_connect(localhost,"root","","NSH");