0

My wordpress insert to database allways inserts new rows ... i try to use the replace but still no joy, im using:

global $wpdb;
$wpdb->replace(bruno_wallet, array( 'nome' => $nome[0],
'valorhora' => $valor_horas ,
'data' => $data ,
'evento' => $evento ,
'horarios' => $horarios,
'obs' => $obs,
'foto' => $ii,
'totalparcial' => $total_parcial,
'id_do_mes' => $id_postt,
'horas' => $numeros_horas ));

to insert on wordpress to database, but i want to only insert if it dosent exists...but now it allways adds new entrys

1 Answer 1

1

Make use of Update Function in WordPress. Did you check the format of the data inserted? If you omit format parameter everything will be considered string that may be the reason WP was not able to detect the row already exists. Try with format of the input %s %d %f . The below link might help you Update_rows Guide

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.