Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Ad icon
ZTE MF283U 4G Unlocked Router (Used)
ayanthamaxi
Updated:
Sunday at 8:26 PM
ලංකාවේ හොඳම උපකාරක පන්ති සහ ගුරුවරුන් එකම තැනකින් - TopTuition.lk
dulithapathum
Updated:
Saturday at 8:07 AM
Colombo
RidhMathraa ’26 🎶✨
Tmadhusanka
Updated:
Jul 15, 2026
Ad icon
Colombo
PXN V10 Pro Direct Drive Racing Wheel (Under Warranty)
Abdur Rahman
Updated:
Jul 15, 2026
Ad icon
USDT ණය සේවාව - USDT Loan Service
පුරවැසියා
Updated:
Jul 15, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
Computers & Internet
Problems and Troubleshooting
mysql database help needed!!
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="sri_lion" data-source="post: 6834833" data-attributes="member: 4103"><p>Ok I think I know your problem... you've set primary keys for "date" and "user_id" this doesn't work that way because "user A" and "user B" maybe getting only single row per day in the database.. right?</p><p></p><p>But the next day they are going to get another row... so having those fields as PK won't do it... because it needs to repeat.. you need a separate PK for this say for example "daily_id" or something...</p><p></p><p>You need to control your input in your script... in the script you make your own primary key by checking "user_id+today's date" when you want to put the record in.. you need to check today's date(string) and user_id combination.. </p><p></p><p>I'll try to give you the pseudo here..</p><p></p><p>[code]</p><p>variable my_id = A</p><p>variable today = 25022010</p><p>variable count = count rows in db where user_id= my_id and todays_date = today</p><p></p><p>if (variable count > 1)</p><p>{</p><p> allow edit only and pop-up msg "you cannot create a new row, would you like to edit the existing one?"</p><p>}</p><p>else </p><p>{</p><p> add a new row</p><p>}</p><p>[/code]</p></blockquote><p></p>
[QUOTE="sri_lion, post: 6834833, member: 4103"] Ok I think I know your problem... you've set primary keys for "date" and "user_id" this doesn't work that way because "user A" and "user B" maybe getting only single row per day in the database.. right? But the next day they are going to get another row... so having those fields as PK won't do it... because it needs to repeat.. you need a separate PK for this say for example "daily_id" or something... You need to control your input in your script... in the script you make your own primary key by checking "user_id+today's date" when you want to put the record in.. you need to check today's date(string) and user_id combination.. I'll try to give you the pseudo here.. [code] variable my_id = A variable today = 25022010 variable count = count rows in db where user_id= my_id and todays_date = today if (variable count > 1) { allow edit only and pop-up msg "you cannot create a new row, would you like to edit the existing one?" } else { add a new row } [/code] [/QUOTE]
Insert quotes…
Verification
Awruddata maasa keeyada?
Post reply
Top
Bottom