Jump to content

cthlnlmd

New Members
  • Posts

    1
  • Joined

  • Last visited

cthlnlmd's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. So I am having this error: Fatal error: Uncaught Error: Call to a member function bind_param() on bool in C:\xampp\htdocs\Practice\exam.php:727 Stack trace: #0 {main} thrown in C:\xampp\htdocs\Practice\exam.php on line 727. Can anyone help me to solve this? if (!empty($FirstName) || !empty($MiddleName) || !empty($LastName) || !empty($Age) || !empty($HomeAddress) || !empty($ContactNumber) || !empty($LastSchoolAttended)) { $host = "localhost"; $dbUsername = "root"; $dbPassword = ""; $dbname = "studentsinformation"; } $conn = new mysqli($host, $dbUsername, $dbPassword, $dbname); if (mysqli_connect_error()) { die('Connect Error('.mysqli_connect_errno().')'.mysqli_connect_error()); } else { $SELECT = "SELECT FirstName, MiddleName, LastName, LastSchoolAttended From information Where FirstName = ? And MiddleName = ? And LastName = ? And LastSchoolAttended = ? Limit 1"; $INSERT = "INSERT Into information (FirstName, MiddleName, LastName, Age, HomeAddress, ContactNumber, LastSchoolAttended) values (?,?,?,?,?,?,?)"; $stmt = $conn->prepare($SELECT); $stmt -> bind_param("ssss", $FirstName,$MiddleName,$LastName,$LastSchoolAttended); $stmt -> execute(); $stmt -> bind_result($FirstName,$MiddleName,$LastName,$LastSchoolAttended); $stmt -> store_result(); $rnum = $stmt -> num_rows; if ($rnum == 0 ) { $stmt->close(); $stmt = $conn -> prepare($INSERT); $stmt -> bind_param("sssisis", $FirstName,$MiddleName,$LastName,$Age,$HomeAddress,$ContactNumber,$LastSchoolAttended); //LINE 727 ERROR $stmt -> execute(); } }
×
×
  • 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.