Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am trying to create a freelance platform where 1 user can hire another user. this should happen by user 1 pressing hire button and user 2 should accept the proposal. When both have accepted, the task should be accepted. How do I achieve this with PHP and MySql? Thanks

What I have tried:

I tried using if both users have pressed the "yes" button, confirm accepted. But it doesn't seem to work.
Posted
Updated 28-Apr-21 6:37am

1 solution

Here's a better scenario:

Create your MySQL database how you will and a table for the responses ('yes'). Relate this table to the task (or whatever) so you can reconcile tasks with acceptances.
Now you have three columns necessary:
client            Reference Leading back to the client
Freelancer        Reference leading back to freelancer 
Client Accept     a date/time field that allows NULL (initial value)
Freelance accept  a date/time field that allows NULL (initial value)

Now you just stamp a field, if "yes" is clicked, with the datetime value of the moment it was accepted (extra data for free) instead of just a flag set to TRUE

Any with both fields with datetime are accepted and in addition a record now exists of when this was done. You can also work out an option for rejection by either if this is on a person-to-person solicitation basis. Or an expiration date.
 
Share this answer
 
v2
Comments
Zaid M 28-Apr-21 14:39pm    
I'm sorry I didn't understand this approach.
what I thought I'd do was create a table "workaccept" with the following columns namely,
1) client username
2) freelancer username
3) work specification/requirement
4) client hire request sent
5) freelancer hire request accepted/not accepted

once these 5 columns are created, the client would click on the send hire request button and a text field appears, where the client enters the job requirement in detail and presses send. The client username, freelancer username, job requirement is stored and client hire request sent column is set to yes.

then on the freelancer dashboard, under pending hire requests, this request is seen with the detailed job requirement( data is called from database here). once the freelancer accepts it, the freelancer accept columns is set to "yes" and when both column 4 and 5 is set to yes, the job is marked as accepted.

Is this the right flow? please explain how can i go about implementing this on php, mysql. thanks
W Balboos, GHB 28-Apr-21 14:48pm    
Instead of "YES" I use a date-time stamp. I also separate the jobs (clients), freelancers, and the responses into separate data tables instead of perhaps on with longer rows. A response record, the table I mentioned, has a reference to client, freelancer, and the date/time if and when they respond.

You could even use this to resubmit to multiple freelancers until the double-yes is achieved and, once this is achieved, remove from active use any other references to the task. That is to say, a job is offered until it is accepted (common sense). You could even add another level and further separate your data by removing the task information from the client and just referencing the client with it. Now you can have a client list, freelancer list, task list that references the client and finally the responses that uses a combination of the first three.

I've got to go, now.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900