SQL quicky pls

Associate
Joined
26 Jan 2006
Posts
1,502
Hello,

I developed a php script to take info from post and insert it in a table in mySQL db. Everything works fine, BUT only once!

I click post and it works, then I try post again but it wont get the second post. However, if I delete the first post from phpMyAdmin and try then it works. So I can have like 1 entry max there? :confused:

ps: I use CURDATE() and CURTIME() to fill some fields btw, dunno if it matters.

Thanks
 
The primary key is the problem it seems. I droped the primary key and now it works like a charm :)

I do not plan to do any relationships btw with this table, so it should be fine without a primary key? (I know its only needed for relationships? or?)

Thanks
 
I sorted the problem. However, I would like my table to be kept always sorted by date (first) and then (time).

For example,

if there 2 entrys on the same date then it sorts by time.

Is this a setting or I need to do timed queries?

Thanks a lot!
 
The "order by" is used when you query the database to order the results returned.

e.g. select * from xxx where aaa = bbb order by ccc


There is nothing wrong with having keys defined on your file, and the way that the data is actually stored is a rather esoteric requirement.

I would investigate the use of indexes/logicals/views for what you require.
 
The order in the table doesn't matter at all. 'ORDER BY' is added to your Select query for when you're displaying the data, so you can tell the database to order the result set :)
 
Back
Top Bottom