php - concrete5 custom block not passing array to view -


I have a custom block made in Concrete 5, it gets an array of all workers from the database and pass it in the view Does it. This block also uses the parameter which is blocked when the block is added to a page (its a part of the WHERE sql statement, i.e. parent_id = 261) Here my task is in Block Controller:

  public function view () {$ db = new mysqli (WP_SERVER, WP_USERNAME, WP_PASSWORD, WP_DATABASE); If ($ db-> connect_errno & gt; 0) {echo '& lt ;! - Unable to connect to database ['$ db- & gt; Connect_uper '] - & gt;'; } Other {$ SQL_ENTRIES = "SELECT * FROM` wp_posts`]" where post_type = 'page' and " Post by replacing $ query. "(Post_ title, 'pound', 'lz')" ACC "; If (! $ Entries_result = $ db- & gt; Query ($ SQL_ENTRIES)) {echo ' ft_sock ()) $ entries [] = $ line; $ SQL_META = "SELECT post_id, meta_key, meta_value fp wp_postmeta WHERE in post_ id (select` wp_posts` id where post_type = 'page' and '. $ Query.') "; If (! $ Meta_result = $ db-> Query ($ SQL_META)) {echo ' fetch_assoc ()) {ifet! ($! [$ Row ['post_id']])) $ Metas [$ row ['post_id']] = array (); $ Metas [$ row ['post_id']] [] = $ line; } $ Updated_entries = array (); ($ Meta [$ entry ['id']])) {foreach ($ meta [$ entry ['id']] $ {$ entry [$ meta] ['meta_key']] = $ meta as meta [ 'Meta_value'];}} $ Updated_entries [] = $ entry;} $ this-> set ('updated_entries', $ updated_entries);}}}}  

and my views In the file:

  $ get = $ updated_entries; echo json_encode ($ received);  

It lists nothing, which is strange, because When the function is placed inside the view file, then it lists everything as usual My guess is that because of your code using a $ query

> Variable, but it is not defined anywhere in the function. If this code works in your view file, then I have a condition that the $ query variable is set in the view itself Or maybe it is WP_SERVER , WP_USERNAME , WP_PASSWORD , and WP_DATABASE constants that you are going through in a database connection ? Where are they coming from?

Side note: I actually expect that it has run properly to avoid the $ query SQL injection. If you are taking some arguments from $ _GET or $ _POST and feed them in $ query then you have a distance protection hole.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -