I made a search.php that finds articles on my site. What I was trying to do was create a voting system that would sort the articles by how many up votes it has. But the articles are in one table and the votes are in another. So what I needed was a foreign key that would be in the voting table that would tell the article table how many up votes it has so search.php would sort accordingly
My question was, how would I set up a foreign key that would handle that?
I just dont know how to set up the foreign key in the article table and the voting table
And why don’t you just update your artices’s vote count along when inserting a row to votes table?
You can use it like