$place_name = $_POST['place_name'];
$state = $_POST['state'];
$country = $_POST['country'];
$geocode = $_POST['geocode'];
$place_lat = $_POST['place_lat'];
$place_lng = $_POST['place_lng'];
$MX_id = $_POST['MX_id'];
$MX_title = $_POST['MX_title'];
$MX_artist = $_POST['MX_artist'];
$track_url = $_POST['track_url'];
$img_url = $_POST['img_url'];
$positive = $_POST['positive'];
$note = $_POST['note'];
//this is variable for the primary key
//this is variable for the primary key
if ($_POST['ntpID']===NULL){
$NTP_id = 0 ;
}else{
$NTP_id = $_POST['ntpID'];
}
//$NTP_id = $_POST['ntpID'];
// if I uncomment this, the value returned is 0 and nothing is updated.
// With it commented out, a new record is added even when the $NTP_id value exists in the ID field.
$t = time();
$usr = get_current_user_id();
$usrnm = get_user_by( 'id', $usr );
$usrlg = $usrnm->user_login;
$updateQuery = "INSERT INTO $table (`id`,`geocode`,
`country`,`img_url`,`MX_artist`,`MX_id`,`MX_title`,`note`,
`place_lat`,`place_lng`,`place_name`,`positive`,`state`,
`track_url`,`user_id`,`user_login`,`geopoint`)
VALUES
($NTP_id,$geocode,'$country','$img_url','$MX_artist',$MX_id,
'$MX_title','$note',$place_lat,$place_lng,'$place_name',$positive,
'$state','$track_url',$usr,
'$usrlg', GeomFromText('POINT($place_lat $place_lng)'))
ON DUPLICATE KEY UPDATE `note`= '$note',`positive`=$positive ; " ;
$wpdb->query($updateQuery);
echo $wpdb->insert_id;
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.