![]() |
Really really EASY php/mysql - 1 line of code needed!
hi I just need someone to help me with one line of code in wordpress backend.
I have a new field in the 'wp_user' table of the wordpress database, All I need to do is write some one line of code which will update that field with a value from $_POST I am struggling now with this crap for a couple of hours... I feel like a retard and most likely am. But can anyone help me out? Thanks. |
mysql_query("UPDATE [yourtablename] SET wp_user = '".mysql_real_escape_string(trim($_POST['username']))."'");
That will do the trick. It will fill every wp_user in the table with your POST value. If that is not what you want, you will have to specify a condition using WHERE. For example: mysql_query("UPDATE [yourtablename] SET wp_user = '".mysql_real_escape_string(trim($_POST['username']))."' WHERE wp_id = 1"); The function mysql_real_escape_string and trim are not necessary, but they add some extra flexibility and security. |
All times are GMT -7. The time now is 01:48 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123