You would really benefit from reading a tutorial on relational databases. There are some crucial concepts and understandings that are not intuitive, but vitally necessary in order to get results from a database. Try using the keywords
database relational fundamentals in Google or Bing or Yahoo! I even wrote one myself a few years ago:
http://forums.aspfree.com/microsoft-acc ... 08217.html (it was written for Microsoft Access, but it applies totally to any relational database).
When you describe a database table, the best way is not to show data, as you have done, but to show the
structure, like this:
[text]table name:
column1name INT (Primary key)
column2name VARCHAR
column3name DATE
column4name VARCHAR
. . .
[/text]
And nearly every functional table needs a primary key. You choose the primary key as whatever field (or fields) will logically and uniquely identify a row. It is, by definition,
unique, that is, there can be no possibility of 2 rows having the exact same value for the primary key column. Or if there is no such "natural" key column, you ADD an arbitrary value column that becomes the primary key. You can designate it as an auto-increment column that the database will assign a value to for every new record, guaranteeing that it will be unique. This is a very common practice.
Another database design rule is that every column in a table (roughly what you think of as a "cell") should be "atomic", meaning that it must contain a single value, not a combination of values. Although it is possible to work with just part of a value, it is highly inefficient and should be avoided. I'm referring to your column of email addresses, where you seemed to expect to identify which row you wanted by just the username part of the address.
Yet another design rule is that, generally, you should not store "calculated values". Here I'm talking about your "month to day" column. If I am interpreting your meaning correctly, you are planning to have a database that stores the number of clicks each email address accumulates. Your database design won't work for that purpose. You should be recording each click with the exact date-time stamp and email address as a row in the table. To show either the total number of clicks, or the number of clicks since the first of the current month, or the total clicks last year, etc. etc., you simply use a SELECT QUERY and you will be able to provide those results. This is what makes relational databases so powerful.
In every case when you want to retrieve stored data, it is done with a SELECT QUERY, which selects the data from one or more rows, and very often from
related data in other tables. So the very first thing you must learn in working with a relational database is the SQL language, which is what your PHP script sends to the database to retrieve the data you want. Back to Google, search for
sql tutorial.
In closing, let me emphasize that relational database design and use is NOT INTUITIVE! It is an entirely different way to think of data than you have ever encountered. It is nothing remotely like a spreadsheet. If you're going to learn how to use them, you really must start at the beginning, not by copying a part of some script.