public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/builder/recordsform.php
/**
		 * Method that saves the meta data, updating existing entries, or creating new ones
		 * as appropriate.
		 *
		 * @param Array $metaSaveList The list of meta_keys => meta_values to save to the database for this record.
		 * @param Mixed $recordID The ID of the record in the main table. (Integer recommended, String works fine).
		 */
Method that saves the meta data, updating existing entries, or creating new ones
as appropriate.

@param Array $metaSaveList The list of meta_keys => meta_values to save to the database for this record.
@param Mixed $recordID The ID of the record in the main table. (Integer recommended, String works fine).
Method that saves the meta data updating existing entries or creating new ones as appropriate . @param Array $metaSaveList The list of meta_keys = > meta_values to save to the database for this record . @param Mixed $recordID The ID of the record in the main table . ( Integer recommended String works fine ) .
protected function saveMetaData( $metaSaveList, $recordID ) {
			if ( empty( $metaSaveList ) || ! $recordID ) {
				return false;
			}
			global $wpdb;
			$wpdb->show_errors();
			foreach ( $metaSaveList as $fieldName => $fieldValue ) {
				$SQL = $wpdb->prepare( "
					SELECT * 
					FROM $this->metaTableName
					WHERE $this->metaForeignKey = %s
					  AND meta_key = %s
					LIMIT 1",
					$recordID, $fieldName );
				$existingDetails = $wpdb->get_row( $SQL, ARRAY_A );
				if ( ! empty( $existingDetails ) ) {
					$SQL = $wpdb->prepare( "
						UPDATE $this->metaTableName
						SET meta_value = %s
						WHERE meta_key = %s
						 AND $this->metaForeignKey = %s						
						", $fieldValue, $fieldName, $recordID );
				} else {
					$SQL = $wpdb->prepare( "
						INSERT INTO $this->metaTableName (meta_value, meta_key, $this->metaForeignKey)
						VALUES (%s, %s, %s)						
						", $fieldValue, $fieldName, $recordID );
				}
				$wpdb->query( $SQL );
			}
		}
protected function saveMetaData ( $ metaSaveList , $ recordID ) { if ( empty ( $ metaSaveList ) || ! $ recordID ) { return false ; } global $ wpdb ; $ wpdb -> show_errors ( ) ; foreach ( $ metaSaveList as $ fieldName => $ fieldValue ) { $ SQL = $ wpdb -> prepare ( " 
					SELECT * 
					FROM  $ this -> metaTableName 
					WHERE  $ this -> metaForeignKey  = %s
					  AND meta_key = %s
					LIMIT 1 " , $ recordID , $ fieldName ) ; $ existingDetails = $ wpdb -> get_row ( $ SQL , ARRAY_A ) ; if ( ! empty ( $ existingDetails ) ) { $ SQL = $ wpdb -> prepare ( " 
						UPDATE  $ this -> metaTableName 
						SET meta_value = %s
						WHERE meta_key = %s
						 AND  $ this -> metaForeignKey  = %s						
						 " , $ fieldValue , $ fieldName , $ recordID ) ; } else { $ SQL = $ wpdb -> prepare ( " 
						INSERT INTO  $ this -> metaTableName  (meta_value, meta_key,  $ this -> metaForeignKey )
						VALUES (%s, %s, %s)						
						 " , $ fieldValue , $ fieldName , $ recordID ) ; } $ wpdb -> query ( $ SQL ) ; } }
Method that saves the meta data, updating existing entries, or creating new ones
 as appropriate.
Method that saves the meta data updating existing entries or creating new ones as appropriate .
// Save each meta value to the meta table. // First check if we've got a record for this meta key already // Got a row for that already, so UPDATE