Jump to content

Recommended Posts

<?php
  include("db_connect.php");
    if(isset($_POST["login"])){
      require("config.php");
      global $database;
      $stmt = $database->prepare("SELECT * FROM single WHERE email=:email"); 
      $stmt->bindParam(":email", $_POST["email"]);
      
      $result = mysqli_query($conn, $sql);
      
      $stmt->execute();
      $count = $stmt->rowCount();
      if($count == 1){           
      $row = $stmt->fetch();
      if($_POST["pass"] == $row["pass"]){  ($row["PASSWORD"])  ($_POST["pw"])
      session_start();
      $_SESSION["email"] == $row["email"];
      header("Location: dashboard.php");
       } else {
         echo "login Success";
       }
       } else {
         echo "Login Error";
      }
      
   }     
      

Fatal error: Uncaught Error: Call to a member function prepare() on string in C:\xampp\htdocs\mysqlilogin\Adminframe.php:35 Stack trace: #0 {main} thrown in C:\xampp\htdocs\mysqlilogin\Adminframe.php on line 35

Link to comment
https://forums.phpfreaks.com/topic/316254-please-identify-my-problem/
Share on other sites

it is not a pdo method its is mysqli method here is my db_connection file

<?php

if (isset($HTTP_GET_VARS))
extract($HTTP_GET_VARS);
if (isset($HTTP_POST_VARS))
extract($HTTP_POST_VARS);

include("config.php");


$link=mysqli_connect($host_name,$user_name,$password);
if (! $link)
         die ( "MySQL error !");
mysqli_select_db($link,$database)
        or die ( "mysqlerror $database :".mysqli_connect_error() );
?>

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.