-
Subject. I have a table(not the only one) where primary key consists of two columns. May be somebody have a solution, with php form connector. I managed to fix it with beforeUpdate event, running quiery in handler, but framework not making safe values, so hacker can break in, the only thing I used is addcslashes. Many libraries support placeholder for sql values , is it apply to PDO, how?
-
While first solution is working, ugly, Im still not managed to work dataview with multicolumn primary key.
<?php require_once('../dx/connector/form_connector.php'); require_once 'common.inc.php'; $form = new FormConnector($conn); function my_update($data){ global $conn,$form; $script=addslashes($data->get_value("script")); $id=(int)addslashes($data->get_value("id")); $description=addslashes($data->get_value("description")); $keywords=addslashes($data->get_value("keywords")); $form->sql->query("UPDATE meta SET description='{$description}', keywords='{$keywords}' where id={$id} and script='{$script}'"); //success() marks operation as finished and stops any further action processing $data->success(); } $form->event->attach("beforeUpdate","my_update"); $form->render_table("meta","script","script,id,description,keywords");