In mysql, what is the meaning of: id and ': ID' => $ orderid?

Source: Internet
Author: User
In mysql, what is the meaning of: id and: id & gt; $ orderid? $ Agentid = pdo_fetchcolumn ('select agentid from '. tablename ('shop _ order ').' Where id =: idLimit 1', array (
': ID' => $ orderid
));

In mysql, what does id =: id and ': ID' => $ orderid mean?

: Is id a placeholder?
$ Orderid is a parameter?


Reply to discussion (solution)

SQL command select agentid from '. tablename ('shop _ order'). 'where id =: id limit 1
In: id is the parameter name of parameterized expression

The second parameter array (': ID' => $ orderid)
In: id is to replace the parameter name: id with the real variable $ orderid


SQL command select agentid from '. tablename ('shop _ order'). 'where id =: id limit 1
In: id is the parameter name of parameterized expression

The second parameter array (': ID' => $ orderid)
In: id is to replace the parameter name: id with the real variable $ orderid


Can this be used only in mysqli?

Both mysqli and PDO can be used.

MySQL itself supports parameterized query
But php_mysql extensions are not supported.

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.