Creating Tables in WordPress Database

It may be a wrong approach, but without creating a plugin, one of my seniors, once did a WordPress Shopping Cart project by creating extra tables for her custom purposes. What she did is to follow the other existing tables in WordPress database.

Suppose what wp_posts table has by default is an ID. She opened up the structure of the table and see:

+=======+============+===========+============+======+=========+================+
| Field |    Type    | Collation | Attributes | Null | Default |      Extra     |
+=======+============+===========+============+======+=========+================+
|  ID   | bigint(20) |           |  UNSIGNED  |  No  |   None  | AUTO_INCREMENT |
+-------+------------+-----------+------------+------+---------+----------------+

Then she followed a similar things to her own table’s ID’s structure. And so on… And where necessary she made a new field with her personal choices.

It’s her process— stealing structures from built-in WordPress db.

This was her methodology to the new table in WordPress for custom purpose. You can simply follow it or any other method proposed by any pro.

But being a newbie you should have to practice much with SQL & PHP first, it’ll help you to understand its basics. All the very best.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)