Hot answers tagged

4

Your problem is likely that $wpdb->jch_gigs is undefined. Is jch_ the prefix of your DB tables, as defined in wp-config.php? If so, try this: $wpdb->prepare( "UPDATE {$wpdb->prefix}gigs SET available = available - %d WHERE ID = %d", $quantity, $item ) ); wpdb class on the Codex


1

Two things, at least: It looks like you need to declare the global $wpdb and you're using $wpdb->insert() incorrectly. The insert() method doesn't take your SQL query but a list of variables. It then create the SQL for you. See here You can execute SQL directly but it's a different process.



Only top voted, non community-wiki answers of a minimum length are eligible