How to understand the single double quotes in this method

Source: Internet
Author: User
How to understand single and double quotes in this method
PHP Code
  
   
  
   db = Mysql::getins ();    }    User Registration method Public    function Reg ($arr) {        $sql = ' insert INTO '. $this->table. "(Username,passwd,email) VALUES ('"). $arr [' username ']. "','" . $arr [' passwd ']. "','" . $arr [' email ']. "')";             return $this->db->query ($sql);       Print_r (Mysql_error ());}    }

That SQL statement single double quotation marks no matter how to understand, forget friends troubleshoot!!!!!!!

------Solution--------------------
Do you understand if you write like this?
$sql = "INSERT INTO $this->table (username,passwd,email) VALUES (' $arr [username] ', ' $arr [passwd] ', ' $arr [email] ');
------Solution--------------------
You give the double quotes in SQL are the string definitions of PHP, and the single quotation marks are the SQL string definitions
------Solution--------------------
Yes. is to stitch it into a SQL string.
------Solution--------------------
discuss
PHP Code
Defined (' ACC ') | | Exit (' Access denied ');

Class Usermodel {
Protected $table = ' user ';
protected $db = false;

Public Function __construct () {
$this->db = Mysql::geti ...
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.