this is my script but cannot connect. errot message error . user root has no password. I have created databse using phpmyadmin
Warning: mysqli_connect(): (HY000/1049): Unknown database 'shop' in C:\wamp64\www\online_shopping\admin\index.php on line 4

pls help

<?php
//error_reporting(1);
//include("config.php");
$conn=mysqli_connect("localhost","root","", "shop") or die(mysqli_error());
extract($_REQUEST);

if($_REQUEST['sub'])
 {
 $name=$_REQUEST['t1'];
 $pass=$_REQUEST['p1'];
 $sel=mysqli_query($conn,"select name, pass  from details where name='$name '");
 $arr=mysqli_fetch_array($sel);
 if($arr['name']==$name and $arr['pass']==$pass)
   {
   session_start();
   $_SESSION['eid']=$name;
  header("location:home.php");
  }
  else
   {
     $er="name and password do not match";
     }
}    
?>

Recommended Answers

All 2 Replies

Thanks I solved the problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.