I have this MySQL query, which do work in PHPMyAdmin:
set @ROW = 0;UPDATE `wp_wpsstm_subtracks` SET `subtrack_order` = @ROW := @ROW+1 WHERE tracklist_id='176226' ORDER BY `subtrack_time` ASC
I would like to use it within Wordpress:
$querystr = $wpdb->prepare("set @ROW = 0;UPDATE `$subtracks_table` SET `subtrack_order` = @ROW := @ROW+1 WHERE tracklist_id='%d' ORDER BY `subtrack_time` ASC", $this->post_id );
return $wpdb->query($querystr);
But it fires a syntax error:
WordPress database error Erreur de syntaxe près de 'UPDATE
wp_wpsstm_subtracks
SETsubtrack_order
= @ROW := @ROW+1 WHERE trackli' à la ligne 1 for query set @ROW = 0;UPDATEwp_wpsstm_subtracks
SETsubtrack_order
= @ROW := @ROW+1 WHERE tracklist_id='176226' ORDER BYsubtrack_time
ASC
How can I make this work ?
Thanks !