0
<?php 
     // chat poster

     $db = new PDO('mysql:host=127.0.0.1;dbname=wordpower','root','bheq0913');

     //secure the chat
     if(isset($_POST['text'])&& isset($_POST['name'])){
        $text = strip_tags(stripslashes($_POST['text']));
        $name = strip_tags(stripslashes($_POST['name']));

        if(!empty($text) && !empty($name)){
                $insert = $db->prepare("INSERT INTO chat VALUES('', '".$name"', '".$text"') ");
                $insert->execute();

                echo "<li class="cm"><b>".ucwords($name)."</b> - ".$text."</li>"; 
        }
     }

?>

Help me out of this error please, it says

Parse error: syntax error, unexpected '"', '"' (T_CONSTANT_ENCAPSED_STRING) in C:\xampp\htdocs\webko\insert.php on line 12

halfer
  • 19,824
  • 17
  • 99
  • 186
jayson
  • 31
  • 5
  • You need 2 concatenation dots – Rizier123 Aug 25 '15 at 15:55
  • It's incredibly bad practise to inject values directly into a prepared statements..... what's the point of using prepared statements if you're going to abuse them like that? – Mark Baker Aug 25 '15 at 15:55
  • sir im newbie in php then i watch tutorials in youtube. but when i follow the tutorial and i code it. that error's come. – jayson Aug 25 '15 at 15:59

0 Answers0