php - Which one is best mysql or mysqli or $wpdb for wordpress plugin -


i have created plugin in wordpress after updated latest version of php mysql_connect not work. shows error php fatal error occurred: call undefined function mysql_close()

i know php version problem need migrate mysqli have doubt 1 best $wpdb query or mysqli query

and refered need use mysqli query above php ver 4.1.3 , should check

if(phpversion()>=4.1.3){ //use mysqli } else { //use mysql } 

can use or there other way?

better use $wpdb wordpress plugin

simple , short:

mysql_query() = faster!

$wpdb->get_results() = safer!

but in cases since $wpdb global object , in memory using be fast mysql_query().

will affect performance?

it can affect better performance changes minor changes not worth it.

https://codex.wordpress.org/class_reference/wpdb

http://php.net/manual/en/mysqli.overview.php


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -