I have 3 tables, images
, icons
, and banners
, each with a unique primary key that is also auto_incremented named image_id
, icon_id
, and banner_id
, respectively.
I'm looping through the above tables and I'm wondering if there's a way I can select the id
column without specifying it's specific name.
Something like
SELECT PRIMARY_KEY
FROM {$table}
Where I don't have to change my table structure or use *
as there would be much data to return and would slow down my application.
Just name the id columns id
in each table. Reserve the whatever_id
naming for foreign keys.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With