0
My sql query is 

$stmt = $db->prepare('INSERT INTO blog_members (bio) 
                        VALUES (:bio) 
                      WHERE username='.$_SESSION['username'].'') ;
$stmt->execute(array(':bio'=> $bio));
?>                                        
 <input type="text" name="bio" id="bio" class="form-control input-lg" placeholder="Your Name" value="<?php if(isset($error)){ echo htmlspecialchars($_POST['bio'], ENT_QUOTES); } ?>" tabindex="1">

    <p><input type='submit' name='submit' value='Submit'></p>
</form>

and the error is

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE username=ashua4' at line 1' in C:\xampp\htdocs\gauravblog\user\update-profile.php:147 Stack trace: #0 C:\xampp\htdocs\gauravblog\user\update-profile.php(147): PDO->prepare('INSERT INTO blo...') #1 {main} thrown in C:\xampp\htdocs\gauravblog\user\update-profile.php on line 147

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149

0 Answers0