WPDB Insert or if exists Update

First, you are using prepare incorrectly. You seem to have $wpdb->update‘s arguments wrapped in $wpdb->prepare like that. That won’t work. In effect, you are passing update a single argument– the output of prepare. Try something simple like the following and you will see why that won’t work: $post_id = 123; $item_stock = 567; var_dump( $wpdb->prepare( … Read more

How do you properly prepare a %LIKE% SQL statement?

The $wpdb->esc_like function exists in WordPress because the regular database escaping does not escape % and _ characters. This means you can add them in your arguments to wpdb::prepare() without problem. This is also what I see in the core WordPress code: $wpdb->prepare(” AND $wpdb->usermeta.meta_key = ‘{$wpdb->prefix}capabilities’ AND $wpdb->usermeta.meta_value LIKE %s”, ‘%’ . $this->role . … Read more

WP_Query with “post_title LIKE ‘something%'”?

I would solve this with a filter on WP_Query. One that detects an extra query variable and uses that as the prefix of the title. add_filter( ‘posts_where’, ‘wpse18703_posts_where’, 10, 2 ); function wpse18703_posts_where( $where, &$wp_query ) { global $wpdb; if ( $wpse18703_title = $wp_query->get( ‘wpse18703_title’ ) ) { $where .= ‘ AND ‘ . $wpdb->posts … Read more

How to display SQL query that ran in query?

Hi @Keith Donegan: If I understand your question correctly I think this is what you are looking for? <?php echo $GLOBALS[‘wp_query’]->request; ?> $wp_query is a global variable that contains the current query run by the loop. If you run the above code anytime while the loop is still active or even right after the loop … Read more

PLS-00049 bad bind variable While using :OLD

You can save it in a local variable (like: v_deletedate) and then use that variable in your insert command. create or replace trigger dis_sal_his after delete or insert or update on employee for each row declare username varchar2(10); v_deletedate date; begin select user into username from dual; v_deletedate := :old.deletedate; insert into employeehistory values(:old.id,:old.name,:old.age,:old.address,:old.salary,v_deletedate); end;

“This SqlTransaction has completed; it is no longer usable.”… configuration error?

I believe this error message is due to a “zombie transaction”. Look for possible areas where the transacton is being committed twice (or rolled back twice, or rolled back and committed, etc.). Does the .Net code commit the transaction after the SP has already committed it? Does the .Net code roll it back on encountering … Read more

ora-06553 pls-306 wrong number or types of arguments in call to ‘ogc_x’

you’ve used double quotes on “X”. this should be ‘X’. the X object is an function in the MDSYS schema, “ogc_x”, so when you say est.tipo_estatus = “X” instead of the correct est.tipo_estatus = ‘X’ it gets translated (as “” is as an identifier so “X” is the same as just typing X) to est.tipo_estatus = mdsys.ogc_x and of course fails.

What is a postgres superuser

https://www.postgresql.org/docs/current/static/sql-createrole.html These clauses determine whether the new role is a “superuser”, who can override all access restrictions within the database. yes – all privileges in all databases on the specified cluster

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)