简体   繁体   English

使用'if(isset($ _ GET')检索组合键而不是主键

[英]Using 'if (isset($_GET' to retrieve composite key instead of primary key

If I was to get a primary key then I would do this: 如果要获取主键,则可以这样做:

if (isset($_GET['item_id']))

But if the table had a composite key (2 attributes that act as a primary key), how would I do this? 但是,如果表中有一个复合键(2个充当主键的属性),我该怎么做? My 2 attributes acting as a composite key are item_id and size_id 我的2个用作组合键的属性是item_id和size_id

If you need to access a row in your database with 2 attributes, then you need to be doing something like: 如果您需要使用2个属性访问数据库中的一行,则需要执行以下操作:

if (isset($_GET['item_id']) && isset($_GET('size_id')))

The other part can't magically appear unless you provide it in some other way. 除非您以其他方式提供,否则其他部分无法神奇地显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM