1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PhP: oop in combination with procedural programming, possible?

Discussion in 'Programming' started by Jangga, Dec 24, 2016.

Tags:
  1. Jangga

    Jangga Junior Member

    Joined:
    Aug 8, 2016
    Messages:
    149
    Likes Received:
    5
    Gender:
    Male
    Occupation:
    Freelancer: A reWriter
    Location:
    Africa
    Please guys.... I have a script written in normal procedural way of writing code but, now I want to secure the script from SQL injection but everyone keep saying I should use prepared statement (which requires oop) to secure my queries. My question is this: is it possible to use oop on a script written with non oop codes? Pls, I need useful answers.....thanks all
     
  2. gsy159

    gsy159 Power Member

    Joined:
    Apr 29, 2011
    Messages:
    685
    Likes Received:
    163
    Hello, yes it is possible just import the code which is written in OOP from a different file
     
    • Thanks Thanks x 1
  3. BigLeague

    BigLeague Newbie

    Joined:
    Dec 11, 2016
    Messages:
    40
    Likes Received:
    8
    Prepared statements aren't anything special. You can just jam them in anywhere. Just shove it in there and let the php handle the rest.
     
    • Thanks Thanks x 1
  4. bartosimpsonio

    bartosimpsonio Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 21, 2013
    Messages:
    12,774
    Likes Received:
    11,429
    Occupation:
    COINZ
    Location:
    BUYAH
    Home Page:
    All the procedural calls and oop to mysql are equivalent. There is a version for each. You don't need to do oop just for this.

    See here : http://php.net/manual/en/mysqli.prepare.php

    There are both styles for all functions.
     
    • Thanks Thanks x 1
  5. Fragmaster

    Fragmaster Jr. VIP Jr. VIP

    Joined:
    Apr 3, 2016
    Messages:
    808
    Likes Received:
    1,067
    Gender:
    Male
    I feel very stupid for not seeing why OP compares programming paradigms with security. I guess that coders today are not what they used to be, properly schooled and informed.
     
    • Thanks Thanks x 1
  6. Jangga

    Jangga Junior Member

    Joined:
    Aug 8, 2016
    Messages:
    149
    Likes Received:
    5
    Gender:
    Male
    Occupation:
    Freelancer: A reWriter
    Location:
    Africa
    Thanks @all for your input.... I appreciate