Tuesday 15 July 2014

php - Wordpress MySQL query not working -


The following code is not working for any reason, I'm just getting a blank page - I'm pulling my hair On this, your assistance will be greatly appreciated.

  & lt ;? Php if ($ _GET ['id']> gt; = '1') {$ data_entry_id = $ _GET ['id']; $ Current_user_id = get_current_user_id (); $ Row_kids = $ wpdb- & gt; Query ("Select * from reg_children, where '% data_entry_id%' and UID = '$ current_user_id'" like kids;); If (! $ Rows_kids)! {$ Wpdb- & gt; Query ("INSERT ('', '$ data_entry_id', '$ current_user_id')" in reg_children VALUES); }}? & Gt;   

Thank you in advance for your help.

you should

  $ row_kids = $ wpdb-> gt; ; Query ("Select * from reg_children, where '% data_entry_id%' and UID = '$ current_user_id'" like kids;);   

You've mesh with single quotes and make sure that $ wpdb has been declared globally.

And there should be a combined query

  $ wpdb-> Query (include "reg_children in VALUES (zero, '$ data_entry_id', '$ current_user_id'));   

And mainly if you should have the statement

  if (empty ($ totalRows_kids)) {  

Forgot to close the brace and make sure you defined $ totalRows_kids ... I think counting results from the selection query

No comments:

Post a Comment