i'm still learning about php ,please help me to find the answer for this
Uncaught Error: Call to a member function prepare() on null in C:\xampp\htdocs\eCommerece\Admin\index.php:15 Stack trace: #0 {main} thrown in C:\xampp\htdocs\eCommerece\Admin\index.php on line 15
<?php
$dsn='mysql:host=localhost;dbname=shop';
$User='root';
$pass='';
try{
$con=new PDO($dsn,$User,$pass);
echo "Your Good Connection";
}
catch(PDOException $e){
echo"Thats Error Connection".$e->getmessage();
}
?>
///////////////////////////////////////////////////////////////
<?php
include 'init.php';
include $init;
include 'includes/language/eng.php';
if($_SERVER['REQUEST_METHOD']=='POST'){
$username=$_POST['user'];
$Password=$_POST['pass'];
$embededpass=sha1($Password);
$stmt=$con->prepare("SELECT UserName , password FROM user WHERE UserName = ? AND password");
$stmt->excute(array($username,$embededpass));
}
?>