<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1027258" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1027258</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/which-better#comment-1168076</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;camperjohn64 wrote:&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Is this bad MySQL programming?  Am I going about it all wrong?&lt;/p&gt;
&lt;p&gt;JM&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Well, kind of, yeah. It&#039;s not so much a matter of familiarity with MySQL, as with relational database design. It&#039;s not the same as object oriented design.&lt;/p&gt;
&lt;p&gt;In general, arrays of this kind are to be avoided in relational db design, you want to be storing your sequences in consecutive of rows, not within the same cell.&lt;/p&gt;
&lt;p&gt;So, short answer is that more fine-grained is better. Store each day in a different row, or for more info, even each click in a different row.&lt;/p&gt;
&lt;p&gt;For a mathematical take check: &lt;a href=&quot;http://www.cs.sfu.ca/CC/354/zaiane/material/notes/Chapter7/node1.html&quot; class=&quot;bb-url&quot;&gt;http://www.cs.sfu.ca/CC/354/zaiane/material/notes/Chapter7/node1.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Or perhaps best of all, I&#039;d recommend this book: &lt;a href=&quot;http://www.amazon.com/exec/obidos/tg/detail/-/0201752840/qid=1111065929/sr=8-2/ref=pd_csp_2/002-9582967-9672015?v=glance&amp;amp;s=books&amp;amp;n=507846&quot; class=&quot;bb-url&quot;&gt;http://www.amazon.com/exec/obidos/tg/detail/-/0201752840/qid=1111065929/sr=8-2/ref=pd_csp_2/002-9582967-9672015?v=glance&amp;amp;s=books&amp;amp;n=507846&lt;/a&gt;&lt;/p&gt;
 </description>
     <pubDate>Thu, 17 Mar 2005 13:26:28 +0000</pubDate>
 <dc:creator>thisnew</dc:creator>
 <guid isPermaLink="false">comment 1168076 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/which-better#comment-1162391</link>
    <description> &lt;p&gt;Hmm, I think my C++ experience is mixing with my lack-of-mysql experience.&lt;/p&gt;
&lt;p&gt;In C++, here is an example of what I want to do. How about a daily histogram of when he clicks just for example&#039;s sake:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;class users&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int&amp;nbsp;&amp;nbsp;&amp;nbsp; user_id;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int&amp;nbsp;&amp;nbsp;&amp;nbsp; daily_histogram[7];&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;void users::user_arrived(int unix_time_seconds)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int whichday = unix_time_seconds / 86400; // Turn seconds into days&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; daily_histogram[whichday % 7] ++;&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;Now in C++ this would bump up the day that the user visited. Here is how I am thinking it is supposed to be done in MySQL:&lt;/p&gt;
&lt;p&gt;Table: &lt;strong&gt;users&lt;/strong&gt;&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;Name	 | Type		| Description&lt;br /&gt;===========================================================&lt;br /&gt;UserID&amp;nbsp;&amp;nbsp; | UNSIGNED INT | (AUTONUMBER) Unique ID for each User &lt;br /&gt;DailyClicks | int(7)&amp;nbsp; | The user&amp;#039;s clicks seperated into day.&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;Again, maybe I am trying to shoehorn MySQL into a C++ way-of-thinking. &lt;/p&gt;
&lt;p&gt;Is this bad MySQL programming?  Am I going about it all wrong?&lt;/p&gt;
&lt;p&gt;JM&lt;/p&gt;
 </description>
     <pubDate>Sun, 05 Dec 2004 14:46:01 +0000</pubDate>
 <dc:creator>camperjohn64</dc:creator>
 <guid isPermaLink="false">comment 1162391 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/which-better#comment-1162366</link>
    <description> &lt;p&gt;Ok, assuming that mySQL did allow for an array of ints, show me the table layout you were planning, and from there I should be able to guide you to a good way to do it.&lt;/p&gt;
&lt;p&gt;Off what you are saying right now, different users, different web pages, I would say:&lt;/p&gt;
&lt;p&gt;Table: &lt;strong&gt;data&lt;/strong&gt;&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;Name	&amp;nbsp; | Type	 | Description&lt;br /&gt;===========================================================&lt;br /&gt;HitDate&amp;nbsp;&amp;nbsp; | DATE	 | The date recorded.&lt;br /&gt;HitUserID | UNSIGNED INT | User ID from the Users Table&lt;br /&gt;HitPageID | UNSIGNED INT | Page ID from Pages Table&lt;br /&gt;HitCount&amp;nbsp; | UNSIGNED INT | The actual count for the user/page/date&lt;/code&gt;&lt;/div&gt;&#039;&lt;br /&gt;
Table: &lt;strong&gt;users&lt;/strong&gt;&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;Name	 | Type		| Description&lt;br /&gt;===========================================================&lt;br /&gt;UserID&amp;nbsp;&amp;nbsp; | UNSIGNED INT | (AUTONUMBER) Unique ID for each User &lt;br /&gt;UserDesc | VARCHAR(30)&amp;nbsp; | The user&amp;#039;s real name, or e-mail, IP, etc.&lt;/code&gt;&lt;/div&gt;&#039;&lt;br /&gt;
Table: &lt;strong&gt;pages&lt;/strong&gt;&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;Name	| Type		| Description&lt;br /&gt;===========================================================&lt;br /&gt;PageID&amp;nbsp; | UNSIGNED INT | (AUTONUMBER) Unique ID for each Page URL&lt;br /&gt;PageURL | VARCHAR(60)&amp;nbsp; | The URL of the page being tracked&lt;/code&gt;&lt;/div&gt;&#039; &lt;/p&gt;
&lt;p&gt;This way, the users are only listed once, as well as the pages. As far as space, it is true that my method would take up a little more, however really about all it is duplicating is the date value, which to me is very little extra for the extra ease in accessing ranges of hits.&lt;/p&gt;
&lt;p&gt;-Greg&lt;/p&gt;
 </description>
     <pubDate>Sun, 05 Dec 2004 02:29:44 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1162366 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/which-better#comment-1162363</link>
    <description> &lt;p&gt;Well I want to use int, but from what I can find on the internet, MySQL does not support arrays of ints.  &lt;/p&gt;
&lt;p&gt;This is exactly what I am asking. How do I have an array of ints? I can&#039;t find any documentation on it or any examples.&lt;/p&gt;
&lt;p&gt;username char (32) default &#039;&#039;&lt;/p&gt;
&lt;p&gt;This is an array of chars (string). I can set a name like &quot;john&quot;, with j,o,h,n&lt;/p&gt;
&lt;p&gt;username_foobar int (32) default &#039;&#039;&lt;/p&gt;
&lt;p&gt;Theortically, this should be an array of ints. But for the life of me I can&#039;t figure out how I can put 10,20,30,40... into this.  From everything I&#039;ve read, MySQL doesn&#039;t seem to support this. It seems the only useful form of int is INT(1)...&lt;/p&gt;
&lt;p&gt;Show me? If I say please?&lt;/p&gt;
&lt;p&gt;JM&lt;/p&gt;
&lt;p&gt;ps - when you mean a seperate record for each day, do you mean a seperate entry into the database for each day?  That could get huge no? If you have a seperate entry for each day, for each user, for each tracker, for each webpage...?&lt;/p&gt;
 </description>
     <pubDate>Sun, 05 Dec 2004 00:36:40 +0000</pubDate>
 <dc:creator>camperjohn64</dc:creator>
 <guid isPermaLink="false">comment 1162363 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/which-better#comment-1162339</link>
    <description> &lt;p&gt;For trackign clicks per day, I would use a separate record for each day, with two fields, DATE and HITS. This method gives you the best option for getting ranges. &lt;/p&gt;
&lt;p&gt;Also consider, text takes more room to store. and then you have have the overhead of programming to break things up and such, waht if you want to calculate a total for a month? a week? 2 months? &lt;/p&gt;
&lt;p&gt;-Greg&lt;/p&gt;
 </description>
     <pubDate>Sat, 04 Dec 2004 11:48:56 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1162339 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
