sql - If staments with php & Mysql -


I need a little bit of your help if statement in PHP, as I am new to it

First of all I have this question:

  $ sqlCmd = "Username by user name. User.user from WHERE user.id = '". $ _GET ['char'] "" 1 border ";   

And now I have another query

  visible $ sqlUpdate =" UPDATE user .user SET level = '1' WHERE id = ''. $ _GET ['four']. '' Border1 '';   

What I have to do, is something like this: Code> If level> 1 run $ sqlUpdate , then print an error. / P>

Thank you! And sorry, if this is a very non-question, then I I'm trying to learn!;)

  visible $ sqlUpdate = "UPDATE user.user SET level = '1' WHERE id = ''. Mysql_real_escape_string ($ _GET ['char']). '' And level & gt; 1 LIMIT 1 ";   

Your code is weak for SQL injection, which you need to avoid all requests properly


Warning

need to avoid get , post and request and a better view will be used.

Good read


  1. Note
    1. The entire ext / mysql PHP extension, which provides the prefix all functions called mysql_ It will be removed in future, and either PDO or MySQLi

      Good read < / P>

      1. .


Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -