Analysing the Error
WordPress database error 42000 : [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near ‘wp_users’. for query SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE ”wp_users” made by display_setup_form, pdo_wpdb->query, pdo_wpdb->_post_query, pdo_wpdb->print_error
…reads as:
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME
LIKE ''wp_users''
Your Problem
It seems you got constant
s in your query string. And those constants are simply not getting triggered.
How to do it the right way
Note: You can’t put constants inside a string. You’ll have to do:
$wpdb->query( $wpdb->prepare( "
SELECT %s
FROM %s
WHERE %s
LIKE %s
" ),
TABLE_NAME,
INFORMATION_SCHEMA,
TABLE_NAME,
like_escape( $wpdb->users )
);
This ↑ is a) save and b) the correct way to do it.
The other missunderstanding
The following…
display_setup_form
pdo_wpdb->query
pdo_wpdb->_post_query
pdo_wpdb->print_error
…seems to come from wrong function naming.
The right way to call table names and $wpdb
(WP_Query
) functions:
The object $pdo_wpdb->query
likely doesn’t exist. You’ll have to call the global $wpdb;
at first. Then you’ll have access to a number of things, like the native query functions.
# Example:
global $wpdb;
// The prefix you set inside your wp-config.php file
echo $wpdb->prefix;
// Default tables:
print_r( $wpdb->users );
print_r( $wpdb->options );
// Custom tables:
print_r( "{wpdb->prefix}your_table_name" );