0

I have the following code:

<?php 
session_start();
echo $_SESSION['Username'];
$mysqli = new mysqli('****','****','****','****');
if($mysqli->errno)
{
    mail("**@yahoo.com", "***/Account.php Connection Error", $mysqli->error . "\nUser: " . $_SESSION['Username']);
}
else 
{
    $stmt = $mysqli->prepare("SELECT FirstName, LastName, Expires, Expires WHERE EMail=?");
    $stmt->bind_param('s', $_SESSION['Username']);
    $stmt->execute();
    $stmt->bind_result($FirstName, $LastName, $Expires);
    $stmt->store_result();
    while($row = $stmt->fetch())
    {
                ....

I am getting VERY strange behavior. I am receiving the error Fatal error: Call to a member function bind_param() on a non-object in /home/content/42/7401242/html/****/Account.php on line 12

I use this EXACT code on many other pages and it works perfectly. Any thoughts why I might be getting this error randomly?

0

2 Answers 2

1

i dont know if you are binding username with email. and also u are missing FROM clause

   $stmt = $mysqli->prepare("SELECT FirstName, LastName, Expires from Expires WHERE EMail=?");
   $stmt->bind_param('s', $_SESSION['Username']);
                               ^^^^^^^^^^-----------------be sure if its email variable
Sign up to request clarification or add additional context in comments.

Comments

1

You missed out the FROM before the table name

SELECT FirstName, LastName, Expires FROM Expires WHERE EMail=?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.