## database – Is it important to have integers inserted using %d rather than %s?

Question

Is it important to have integers inserted using %d rather than %s?

I have a situation where there is a large number of fields and values. When database changes are made, it is difficult to match all the field types to the data format. It would be much easier to have them all be %s, even integers, but I am not sure of the ramifications of that.

    $data = array( 'field1' =>$this->val1,
'field2'    => $this->val2, 'field3' =>$this->val3,
<snip>
'field100'  => $this->val4 )$format = array(  '%d', '%s', '%d',  <snip> '%s');

$wpdb->insert($db_example, $data,$format );



I know the format option is optional, again, what are the possible ramifications of not using it at all?

0
5 months 2022-07-02T18:58:02-05:00 0 Answers 0 views 0