Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

How to prevent SQL Injection?

Asked Modified Viewed 3,283 times
M
mawe4585
M
  • Member, joined since
  • Contributed 84 posts on the community forums.
  • Started 34 threads in the forums
  • Started this discussions
asked
Member

Hello,

i'm working on an infusion where i have to post data.
How can i make sure that there won't be any SQL injections?

Currently i use it like this:

if(isset($_POST['sample_field'])){
  $samplefield = stripinput($_POST['sample_field']);
  dbquery("insert into ".DB_SAMPLE_TABLE."(sample_field)values('$samplefield')");
}


is the useof stripinput enough or should i use the add_slashes method in addition to that?
0 replies

4 posts

C
Christian
C
Best regards,
Christian Damsgaard Jørgensen.
  • Member, joined since
  • Contributed 125 posts on the community forums.
  • Started 4 threads in the forums
answered
Member

stripinput will do the trick :)
0 replies
P
PreFiX
P
PreFiX 10
Sorry for my bad english :/
  • Junior Member, joined since
  • Contributed 18 posts on the community forums.
  • Started 2 threads in the forums
answered
Junior Member

H
Hal Ricard
H
Hal Ricard
  • Member, joined since
  • Contributed 95 posts on the community forums.
  • Started 12 threads in the forums
answered
Member

-
PHPFusion:
stripinput();
Study the functions of "maincore.php"

Native PHP:
PDO::prepare();
http://www.php.net/manual/en/intro.pd...ro.pdo.php

Regards,

-
0 replies
M
mawe4585
M
  • Member, joined since
  • Contributed 84 posts on the community forums.
  • Started 34 threads in the forums
  • Started this discussions
answered
Member

Ah great thank you guys :)
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 4 posts
  • Votes 0 votes
  • Topic users 4 members

4 participants

C
C
Best regards,
Christian Damsgaard Jørgensen.
  • Member, joined since
  • Contributed 125 posts on the community forums.
  • Started 4 threads in the forums
M
M
  • Member, joined since
  • Contributed 84 posts on the community forums.
  • Started 34 threads in the forums
  • Started this discussions
H
H
Hal Ricard
  • Member, joined since
  • Contributed 95 posts on the community forums.
  • Started 12 threads in the forums
P
P
PreFiX 10
Sorry for my bad english :/
  • Junior Member, joined since
  • Contributed 18 posts on the community forums.
  • Started 2 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet