Tag System |
[eluser]JulianM[/eluser]
Hi. Did you evaluate to use CXTags 1.0? It worked nice for me for many projects. Julian
[eluser]Sein Kraft[/eluser]
Yes, the problem I've already finished the read system of tags and integrated to my project...at this point i shouldn't change everithing.
[eluser]JulianM[/eluser]
Ah Ok. However CXTags has a simple scheme, it would be easy to integrate to any existing project. Julian
[eluser]jedd[/eluser]
[quote author="Sein Kraft" date="1239597633"]It simple. t_count is an integer. If the tag is used in another image it grow. By ex. I've 27 images with the tag "coconuts" the value of t_count on the tag "coconuts" will be 27. [/quote] Don't do it this way. If you want to know how many pictures have a given tag, use a SELECT COUNT() query instead. eg. Code: mysql> SELECT COUNT(*) AS count FROM tag WHERE name="coconut"; You then say: Quote:I'm inserting an auto increment because i use it to vincule the tags with the images using the node table. But you can't have multiple rows with the same ID. Or more accurately, you can't have multiple rows with the same Primary Key - and since you won't show me your schema, I'm just guessing that your ID column is your primary key, in which case my first statement is true. So your code - that you still have here (I corrected it in the last post) : Code: $data = array( -- will work once, but the second time it will fail because you're trying to have two primary keys both set to NULL. Please refer my previous post for how to not do this. You shouldn't really, if you are using an autoincrement field, have a NULL in there at all - it'll make subsequent searches much harder.
[eluser]Sein Kraft[/eluser]
Here you have the sql Code: -- phpMyAdmin SQL Dump g_id is the id of the image in images table. with a big gallery of thousands of images the Select Count can be a problem.
[eluser]jedd[/eluser]
Hmm .. I thought you said you were using the 3-table approach, but you have shown two here? Did you specify a primary key on your node table? It doesn't look like it has one - it might be assuming something that you don't agree with (either the first, or a compound key). Quote:with a big gallery of thousands of images the Select Count can be a problem. Are you saying this because you have already run tests to evaluate the performance ... or because you think a computer will have trouble counting past 1,000 ? Seriously - use COUNT() - it'll be blindingly fast, and you won't have to update your tag table every time you modify your image table. How frequently do you think you will need to know the number of occurrences of a tag across all images anyway?
[eluser]Crimp[/eluser]
This thread seems to complicate things more than necessary. You have a standard many-to-many db relationship and thus need to use a lookup table. The t_count column is, as pointed out, not needed. Delete it. |
Welcome Guest, Not a member yet? Register Sign In |