php - Wordpress plugin: a safe way to store mySQL query contitions -


lets want create wordpress plugin, data plugins custom table in wordpress database , add content each post. woul propably someting this: select * $my_table time between $prevoius_post_time , $current_post_time order time limit 5000

there should way modify query posts editor add additional filters this, end like:

select * $my_table time between $prevoius_post_time , $current_post_time && $filter order time limit 5000,

where $filer filterrow1 != 300 && filterrow2 >=7, created using form ($_post) in backend before publishing new post.

now not sure store $filer variable, little bit afraid of sql injections etc. safe enough store $filer in posts meta via update_post_meta() , receive get_post_meta() function before actual query?

or missing other , better way? since filters may complex, dont see way of storing $filter array $key => $value , generate whole filter on each request.

hei. can use $filter = mysql_real_escape_string($filter); or can use $wpdb prepare function (look wordpress manual). takes care of sql injections.


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -