The prepare-statement tag has no wiki summary.
0
votes
0answers
15 views
Wordpress $wpdb->query() inserts multiple rows with duplicate data
I am experiencing very strange problem with wordpress query() function.
I have a form on page 1 where below code to insert a new record.
if(isset($_POST["transaction_id"])){
global $wpdb;
...
0
votes
0answers
12 views
Mysql Like doesn't work with prepare? [duplicate]
i need to get a result using LIKE in mysql , so i have write code like below
$sql = $wpdb->prepare( "SELECT nr, homeTeamId, awayTeamId, homeScore, awayScore
FROM ...
4
votes
1answer
97 views
Custom query to get post names beginning with a digit
I'm implementing an A-Z index for a custom post type. I've got my links printing out the page and the query working for the letters. However, the numbers are tripping me up because I don't want them ...
4
votes
1answer
68 views
prepare() not working
When I do this:
$transients = $wpdb->get_col(
"
SELECT option_name
FROM $wpdb->options
WHERE option_name
LIKE '_transient_wb_tt_%'
"
);
It works ...
1
vote
2answers
174 views
wpdb->prepare function remove single quote for %s in SQL statment
I am using the below wpdb->prepare function in a sql statement. I am passing in several variables some field names and some values. When I try to use the %s for the field name it puts single quotes ...
1
vote
2answers
400 views
Can't pass table to $wpdb->prepare
I'm having trouble passing a table variable to $wpdb->prepare(); Here is functioning code:
$table = $wpdb->get_blog_prefix( $blog_id ) . 'my_table';
$voters = ...
3
votes
1answer
629 views
Does $wpdb->prepare not create a prepared statement that I can execute multiple times?
I am wondering from the syntax
$sql = $wpdb->prepare( 'query' [, value_parameter, value_parameter ... ] )
It appears (from the syntax - values within prepare) that it simple escapes values not ...
4
votes
2answers
1k views
What is the best way to sanitize data?
I've read several topics about this and different ppl have different views on the best practice.
In terms of WP, how do I store data to DB the safest way?
This is one insert I'm using now:
...
