0

I do also validate $type, and use get/set.

private function somfunc($sql) {
    // query and return result set as an array
}

private function mytype($type) {
    switch ($type)
    case topic: $sql="......";
    return sql;
}

public function display($type) {
    // switch case to require template
    // call somefunc and mytype here
}

If it's not secure, how do I improve my code?

Rubens
  • 14,478
  • 11
  • 63
  • 92
Ds Klur
  • 103
  • 1
  • 8

1 Answers1

0

Is it secure to use sql as parameter in private function?

The two things are not connected. It's not like using sql as parameter in public function is any safer. The visibility / access of a function does not impact on the safety of SQL. Prepared statements do.

Shoe
  • 74,840
  • 36
  • 166
  • 272