Posted By

lzyy on 04/16/09


Tagged

query getmagicquotesgpc


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

farondomenicgmailcom


get_magic_quotes_gpc & mysql query


 / Published in: PHP
 

URL: http://cn.php.net/get_magic_quotes_gpc

Magic quotes for incoming GET/POST/Cookie data.

This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.

  1. <?php
  2. echo $_POST['lastname']; // O\'reilly
  3. echo addslashes($_POST['lastname']); // O\\\'reilly
  4.  
  5. $lastname = addslashes($_POST['lastname']);
  6. } else {
  7. $lastname = $_POST['lastname'];
  8. }
  9.  
  10. echo $lastname; // O\'reilly
  11. $sql = "INSERT INTO lastnames (lastname) VALUES ('$lastname')";
  12. ?>

Report this snippet  

You need to login to post a comment.