Reputation: 1420
I have the following query which working fine.
$stmt = $sql->prepare("INSERT INTO _dashboard_users(
Email,
Password,
FirstName,
LastName,
BusinessName,
BusinessRole,
Address,
City,
State,
PostalCode,
Phone,
Website) VALUES(?,md5(?),?,?,?,?,?,?,?,?,?,?)");
$stmt->bind_param("ssssssssssis",
$Email,
$Password,
$FirstName,
$LastName,
$BusinessName,
$BusinessRole,
$Address,
$City,
$State,
$PostalCode,
$Phone,
$Website);
$stmt->execute();
But this one throwing a headache.
$stmt = $sql->prepare("INSERT INTO scrape(
Kategorie,
Hersteller,
Artikelnummer,
Bezeichnung,
EAN,
UPC,
Beschreibung,
Technische_Daten,
Sprache,
URL,
Marktrelease,
Bild) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)");
$stmt->bind_param("ssssssssssss",
$Kategorie,
$Hersteller,
$Artikelnummer,
$Bezeichnung,
$EAN,
$UPC,
$Beschreibung,
$Technische_Daten,
$Sprache,
$URL,
$Marktrelease,
$Bild);
$stmt->execute();
Fatal error: Call to a member function bind_param() on a non-object~
Can anyone give me a reason why this is happening? I am 100% sure what I am writing, bind_param is a member function of $stmt.
**UPDATE:** I initiliazed $sql like this $sql = new mysqli(DB_HOST,DB_USER,DB_PASS,DB_NAME);
Upvotes: 0
Views: 1579
Reputation: 3661
You second query returns an error. The $sql->prepare
fails, so $stmt
is not an object (as told in your error). You can't call a method on a non-object.
Upvotes: 1