[wp-trac] [WordPress Trac] #27466: WordPress 3.9 issue - database connection lost on mysql_real_escape_string() / AJAX?
WordPress Trac
noreply at wordpress.org
Thu Mar 20 22:03:16 UTC 2014
#27466: WordPress 3.9 issue - database connection lost on
mysql_real_escape_string() / AJAX?
--------------------------+-----------------------
Reporter: harmr | Owner:
Type: defect (bug) | Status: reopened
Priority: normal | Milestone:
Component: Query | Version:
Severity: normal | Resolution:
Keywords: close | Focuses:
--------------------------+-----------------------
Changes (by harmr):
* status: closed => reopened
* resolution: invalid =>
Comment:
sorry, just a short follow up question - just tried to replace
$l_condition = isset($_GET['q']) ? "AND l.name LIKE '%" . $_GET['q'] .
"%'" : '';
with
$l_condition = isset($_GET['q']) ? "AND l.name LIKE '%" .
$wpdb->prepare($_GET['q']) . "%'" : '';
but that through a warning as second argument is needed. so I tried
$l_condition = isset($_GET['q']) ? "AND l.name LIKE '%" .
$wpdb->prepare("%s", $_GET['q']) . "%'" : '';
but that didnt work either - now I have a SQL syntax error:
(SELECT l.id, 'icon-layer.png' as 'icon', l.name as 'name', l.updatedon,
l.updatedby, 'layer' as 'type' FROM wp_leafletmapsmarker_layers as l WHERE
l.id != '0' AND l.name LIKE '%'s'%') UNION (SELECT m.id, m.icon as 'icon',
m.markername as 'name', m.updatedon, m.updatedby, 'marker' as 'type' FROM
wp_leafletmapsmarker_markers as m WHERE m.id != '0' AND m.markername LIKE
'%'s'%') order by updatedon DESC LIMIT 50
could you please help & tell what the proper replacement would be here?
thx
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27466#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list