How to protect the entire request from injection?

  • 0
    Hello everyone. Moved to PDO. I use name placeholders for protection, it's very convenient.
    How to make a placeholder in a multiple array?
    $a = array(
      11 => array('param' => 'параметр1', 'val' => 'значение1'),
      22 => array('param' => 'параметр2', 'val' => 'значение2'),
      33 => array('param' => 'параметр3', 'val' => 'значение3')
    );
    
    $query_array = array();
    foreach($a as $k => $v){
    	$query_array[] = "(".intval($k).", '".$v['param']."', '".$v['val'].")";
    }
    
    $query = "INSERT INTO `tab` VALUE ".implode(", ", $query_array);
    echo $query;
    MySQL Aiden Stanley, Jan 28, 2019

  • 1 Answers
  • 0
    The fan has everything chewed up!

    phpfaq.ru/pdo#multi
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!