Sunday, July 3, 2022
HomeWordPress Developmentdatabase - Is it necessary to have integers inserted utilizing %d relatively...

database – Is it necessary to have integers inserted utilizing %d relatively than %s?


Is it necessary to have integers inserted utilizing %d relatively than %s?

I’ve a state of affairs the place there’s numerous fields and values. When database adjustments are made, it’s troublesome to match all the sphere varieties to the info format. It could be a lot simpler to have all of them be %s, even integers, however I’m not certain of the ramifications of that.

    $information = 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, $information, $format );

I do know the format possibility is optionally available, once more, what are the potential ramifications of not utilizing it in any respect?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments