PHP basic question: error message with every insert

I have received an error statement with every insert statement that I have tried. I am new to PHP. “Internal Server Error” I spoke with the ISP they say I have a "PHP Parse error: syntax error, unexpected T_STRING in

/hermes/bosoraweb131/b736/ipg.immenselyamazingmark/oratorslecturn/index.php "

I only line that I have changed to eliminate the error message is: $sql = “INSERT INTO content_tbl (contenttext, submittedby) VALUES ($contenttext, $submittedby)”;
I have substituted the variables for stings “some test” etc. perhaps it is also possible to have had it working ? IE does not seem to refresh every iteration? I have copied many examples substituting my db and table name with the same error message. Any ideas?

showing a little more code would be helpful, for example:
[php] public function create($data) {
if (is_array($data)) { // If statement probably not needed:

        /* Secure the Password by hashing the user's password. */
        $data['password'] = password_hash($data['password'], PASSWORD_BCRYPT, array("cost" => 15));
        try {

            /* Set the query variable */
            $this->query = 'INSERT INTO users (username, password, confirmation_code, security_level, first_name, last_name, email, date_added) VALUES (:username, :password, :confirmation_code, :security_level, :first_name, :last_name, :email, NOW())';

            /* Prepare the query */
            $this->stmt = $this->pdo->prepare($this->query);

            /* Execute the query with the stored prepared values */
            $this->result = $this->stmt->execute([
                ':username' => $data['username'],
                ':password' => $data['password'],
                ':confirmation_code' => $data['confirmation_code'],
                ':security_level' => $data['security_level'],
                ':first_name' => $data['first_name'],
                ':last_name' => $data['last_name'],
                ':email' => $data['email']
            ]); // End of execution:

            if ($this->result) {
                return "Data was successfully entered in table";
            }
        } catch (PDOException $error) {
            // Check to see if name is already exists:
            $errorCode = $error->errorInfo[1];
            if ($errorCode == MYSQL_ERROR_DUPLICATE_ENTRY) {
                error_log("Duplicate Name was Enter", 1, "[email protected]");
            } else {
                throw $error;
            }
        }
    } // End of main if-statement:
}[/php]

that is just an example and wrap it around php tags that you’ll find in the editor.

Sponsor our Newsletter | Privacy Policy | Terms of Service