Inserting data in a particular column where login id is already present
Inserting data in a particular column where login id is already present
I want to write an sql command in PHP in which I want to insert a data in a particular column having particular data already present in that row.Here is the image where I want to insert 1_day_device to a particular 1_day_id
Also, how can I autodelete a row after a certain time? Like, in the image I want to delete one complete row after one day. I am using PHP for server-side.
replace
See: dev.mysql.com/doc/refman/5.7/en/event-scheduler.html
– fyrye
Jul 3 at 4:11
What have you tried so far?
– fyrye
Jul 3 at 4:13
I am getting data from two different sources. First, I get 1_day_id from one source then I get 1_day_device from another source. Now "996609" should get "bdb*********" but right now it's in another row. Similarly, for id "1595281" I want to insert "3cf4********" in that row.
– Jeetu Routela
Jul 3 at 4:18
1 Answer
1
I think you are looking for the update query with particular 1_day_id. Try with the below query.
UPDATE your_table_name SET 1_day_device='".$device."' WHERE 1_day_data='".$data."'
For delteting the records please follow this link Delete row from database automatically after 24 hours
Please do not use
mysql_**
based functions, as they are no longer supported, use mysqli_***
or PDO
instead. Additionally please reference the use of prepared statements to avoid SQL injection.– fyrye
Jul 3 at 4:15
mysql_**
mysqli_***
PDO
ok, I have updated my answer
– shubhangee
Jul 3 at 4:16
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Seems like you are looking for
replace
query– Arvind
Jul 3 at 3:53