To get a %
character into your SQL string without confusing sprintf()
add it to the replacement string:
$alabala_sql = $wpdb->prepare(
"
SELECT *
FROM $wpdb->posts p
INNER JOIN $wpdb->term_relationships tr
ON p.ID = tr.object_id
INNER JOIN $wpdb->term_taxonomy tt
ON tr.term_taxonomy_id=tt.term_taxonomy_id
INNER JOIN $wpdb->terms t
ON t.term_id=tt.term_id and t.slug= %s
WHERE
p.post_title LIKE %s
AND p.post_type="filmi-i-serialii"
AND p.post_status="publish";
",
$curPageId,
$getChar . '%'
); /* ^ like this */
Related Posts:
- Use wpdb->prepare for `order by` column name
- prepare() not working
- $wpdb->prepare with LIKE returning blank array instead of rows
- Unknown column in ‘field list’ error on MySQL Update query
- When should I use CROSS APPLY over INNER JOIN?
- Insert Data Into Temp Table with Query
- How to create Temp table with SELECT * INTO tempTable FROM CTE Query
- SQL SELECT WHERE field contains words
- Using group by on multiple columns
- Efficiently convert rows to columns in sql server
- Nested select statement in SQL Server
- What’s the difference between VARCHAR and CHAR?
- How to split the name string in mysql?
- Sql Server equivalent of a COUNTIF aggregate function
- Column name or number of supplied values does not match table definition
- Simple PHP Pagination script
- ORA-12560: TNS:protocol adaptor error
- How can I select the first day of a month in SQL?
- Warning: Null value is eliminated by an aggregate or other SET operation in Aqua Data Studio
- SQL – HAVING vs. WHERE
- What’s the difference between RANK() and DENSE_RANK() functions in oracle?
- MySQL combine two columns into one column
- How to SUM two fields within an SQL query
- DateTime2 vs DateTime in SQL Server
- ORA-01861: literal does not match format string
- Difference between numeric, float and decimal in SQL Server
- SQL Server Insert if not exists
- SQL Server: Invalid Column Name
- “ORA-01438: value larger than specified precision allowed for this column” when inserting 3
- ERROR: there is no unique constraint matching given keys for referenced table “bar”
- How do I query for all dates greater than a certain date in SQL Server?
- Cast from VARCHAR to INT – MySQL
- Conversion failed when converting the varchar value ‘simple, ‘ to data type int
- postgresql: error duplicate key value violates unique constraint
- Is there a workaround for ORA-01795: maximum number of expressions in a list is 1000 error?
- ORA-06502: PL/SQL: numeric or value error: character string buffer too small
- Insert into a MySQL table or update if exists
- How to round down to nearest integer in MySQL?
- Convert timestamp to date in Oracle SQL
- How do I reset a sequence in Oracle?
- MySQL error: key specification without a key length
- SQL: Two select statements in one query
- Update statement with inner join on Oracle
- Can I use multiple “with”?
- SQL Server dynamic PIVOT query?
- Incorrect syntax near ”
- MySQL: Can’t create table (errno: 150)
- Join vs. sub-query
- Alternative to except in MySQL
- What does Include() do in LINQ?
- SQL Server “cannot perform an aggregate function on an expression containing an aggregate or a subquery”, but Sybase can
- Arithmetic overflow error converting varchar to data type numeric. ’10’ <= 9.00
- Difference between EXISTS and IN in SQL?
- What does * mean in sql?
- INSERT VALUES WHERE NOT EXISTS
- Using union and order by clause in mysql
- Difference between `load data inpath ` and `location` in hive?
- How to implement LIMIT with SQL Server? [duplicate]
- What’s the best way to dedupe a table?
- SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999
- Multipart/formatted MySQL query problem
- Inserting Post Meta From SQL
- How to make an activities stream mixing posts and comments?
- Moving database with phpMyAdmin
- WPDB: how to get the value of a field in a custom database table
- Get WooCommerce product attribute taxonomies in a SQL query on WordPress database
- How do I escape a table name or column name in SQL? esc_sql doesn’t do this
- Fetch all Posts where logged in user has commented
- Best Way to Merge a Dev and Live Site to Become a Staging Site?
- how to delete 30 day old data using PHP [closed]
- Needing to move content from postmeta to posts in sql [closed]
- Querying wpdb using PHP
- $wpdb->prepare with ON DUPLICATE KEY UPDATE
- Is there a WP function to get taxonomy name from taxonomy_term_id?
- wpdb query problem to access previous 3 days posts
- I can’t figure out what’s wrong with this statement. $wpdb->query update
- WPDB Placeholders and second argument for prepared statements
- List of ways to access WordPress database?
- How to optimize multiple insert into wordpress database
- How can I add a new row in a separate database when someone registers via WordPress?
- Clear Terms from Taxonomy for Specific Post IDs?
- WordPress can I manually add columns in users table and display it in the default manage user plugin and registration form? [closed]
- What does the $posts_join filter join to?
- How do I query for posts by custom meta and those that have been stickied?
- Fetching review value using wpdb class
- Why is my insert row only inserting the final row from the loop into the database rather than just inserting one
- Database SQL query error
- Delete oldest wordpress post (SQL query)
- What argument does my function need to echo get_results() query results
- wpdb->update update the entire table instead of one row
- Alter the main search query to search posts by coauthor user name
- Creating a “forum” – showing last post or last commented post
- Wpdb generates too many queries
- SQL Query to select post title & post ID from a particular category
- Replace Unwanted Space in Post Content URL
- SQL to transform all email addresses in my DB in lowercase [closed]
- query using wpdb in wordpress gets me no result
- How to write inner join using posts_clauses?
- query_vars doesn’t return query string (trying to get data from $wpdb)
- This SQL request call all time and overload my server : SELECT meta_value FROM wp_sitemeta WHERE meta_key = ‘wp_installer_network’ AND site_id = 1