Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 682 Vote(s) - 3.54 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How To Update row in custom wordpress table

#1
Ive Tried And Tried Looking Up How To Approach Editing/Updating Rows In Custom Wordpress Tables I Have It Set To Grab Current logged in user's username which then compares to a custom wp_ table With UserNAme As The Primary Key Which Then I Would Like To Edit A Particular Column/Field On That Particular Row By Passing The Value Of A Variable Over After It Confirms Current Logged In User Matches The Primary Key UserName In My Custom Table"wp_customers" What Am I Doing Wrong With This Line Of Code Or Do You Have A Better Solution

$current_user = wp_get_current_user();

$johnny = $current_user->user_login;
$subs = 'illinois';
global $wpdb;
$wpdb->query(
"
UPDATE $wpdb->wp_Customers
SET BuyersAddress = $subs
WHERE UserName = $johnny

");
Reply

#2
Try this code.

$current_user = wp_get_current_user();

$johnny = $current_user->user_login;
$subs = 'illinois';
global $wpdb;
$table_name = $wpdb->prefix."Customers";

$wpdb->query( $wpdb->prepare("UPDATE $table_name
SET BuyersAddress = %s
WHERE UserName = %s",$subs, $johnny)
);
Reply

#3
Try this code

A simple WordPress Update query

[WP Update][1]

$current_user = wp_get_current_user();

$johnny = array('UserName' => $current_user->user_login);
$subs = array('BuyersAddress' => 'illinois');
global $wpdb;
$table_name = $wpdb->prefix."Customers";

$wpdb->update($table_name, $subs, $johnny);


Hope this will help you

[1]:

[To see links please register here]

Reply

#4
$msg='';
if(isset($_POST['submit']) && $_POST['submit']=='Submit')

{
$assID =12; //pass your table id
$table_name = $wpdb->prefix."assigned_user"; //custom table name
$ds = $_POST['driverStatus'];
$wpdb->query( $wpdb->prepare("UPDATE $table_name SET driverStatus = '".$ds."' WHERE id ='".$assID."' ")
);

$msg = 'Successfully Delivered!';
}
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through