0

I am having trouble converting this to wordpress compatible code:

$result = $conn->query("SELECT * FROM {$table} WHERE id='$playlist_id'");

$num_fields = mysqli_num_fields($result);

$headers = array();
for ($i = 0; $i < $num_fields; $i++) {
      $headers[] = mysqli_fetch_field_direct($result, $i)->name;
}

I have managed to do some:

$stmt = $wpdb->prepare("SELECT * FROM {$table} WHERE id = %d", $playlist_id);
$result = $wpdb->get_results($stmt, ARRAY_A);

foreach($result as $row){

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.