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";
     }
}    
?>
Re: cannot connect to database but can connect with command line 80 80

Can you share your command line details as well as show tables?

Example: https://alvinalexander.com/blog/post/mysql/list-tables-in-mysql-database

Re: cannot connect to database but can connect with command line 80 80

Thanks I solved the problem.

Be a part of the DaniWeb community

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