Skip to content

phplock/php-eav-example

 
 

Repository files navigation

php-eav-example

This is quick example of how to use the EAV model with PHP and MySQL that I started to describe on my blog.

In our example we use the table 'cars' as a lookup table. You'd normally create these types of lookup tables for any type of bound data. For example in this case we could have a look up table for types of cars, or types of cars made before 1980, all while only having our unique data stored in one table.

Files

example-pump-data.php

Run this file first if you want to use the example on your dev instance. It will dump some data into your tables to run the save and pulls.

example-saving-data.php

With this script I show my example of how to import the example data provided.

example-pulling-data.php

Just a single query as an example of how to do a big pull with a subquery. This isn't how you'd "normally" end up getting this info.

About

Example using the EAV design pattern with PHP and MySQL

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%