title: PHP Tag Cloud
body: <p>I am looking for help with the database scheme, not the actual "cloud" itself.</p>
  
  <p>In a site where users submit images and can tag images, how should the database be setup for optimal performance?</p>
  
  <p>I was thinking</p>
  
  <pre><code>ID - int(11), unique, auto_incremenet
  tag - varchar(20)
  imageID - int(11)
  </code></pre>
  
  <p>so suppose i upload an image, and tag it "toronto, sushi, summer".</p>
  
  <p>query would be:</p>
  
  <pre><code>INSERT INTO tags (tag, imageID) VALUES ('$tag[0]', $imageID);
  INSERT INTO tags (tag, imageID) VALUES ('$tag[1]', $imageID);
  INSERT INTO tags (tag, imageID) VALUES ('$tag[2]', $imageID);
  </code></pre>
  
  <p>Then to retrieve, i'd select * from tags where imageID = $imagID.</p>
  
  <p>Is there a flaw with this?</p>