joomla2.5 - I get SQL syntax error -
I use Joomla 2.5.27 and Community Builder 2.0.2. I use the CB rank plugin for Community Builder I get the error
There is an error in your SQL syntax; Check the manual related to your MySQL server version for the correct syntax to use on the nearest 'and
from COUNT (confirmation
= 1 andapproved
= 1' on line 1. SQL = SELECT R2yze_comprofiler WHEREcb_points
andconfirmation
= 1 andapproved
= 1id
) / Blockquote>How to fix this error
PHP code
// Calculate the rank if ($ ordertype == "less") {$ _CB_database - & gt; SetQuery (select "#__comprofiler from COUNT (` id`) WHERE` $ field name` & lt; $ user field and 'confirmation' = 1 and 'accepted' = 1 ');} and {$ _CB_ database-> gt; "$ Field name" & gt; $ user field and 'confirmation' = 1 and 'accepted' = 1 ") from SELECT COUNT (` id`);} $ value = $ _CB_ database-> loadResult () + 1;
Full PHP code
gt; cbfold_rank ')); $ _PLUGINS- & gt; RegisterUserFieldParams (); Class CBField_Gel Expands CBfield_counter {/ ** * Returns the field in the specified format * * @The Ultimate Mosposprophiler Fields $ Field * @ Ultimate Moscoprophelter User $ @ Param String $ Output 'html', 'xml', 'json', ' Php ',' CSV ',' RSS ',' CSV ',' RSS ',' FieldList ',' HTMLLead '* @ Ultimate String $ Reason' Profile 'for user profile view,' Edit 'for profile editing, Registration For 'registering User list for 'list' absolute int $ list_compare_types IF reason == 'search': 0: simple 'is' search, 1: advanced search with mode, 2: simple 'any' search * @ Milan * Retention mixed * / function getField (& amp; $ field, and $ user, $ output, $ reason, $ list_compare_types) {global $ _CB_framework, $ ueConfig, $ _CB_ database; $ OReturn = null; $ Field name = $ field- & gt; Parameters-> Get ('field order name', 'hit'); $ Ordertype = $ Field- & gt; Parameters-> Receive ('Field Order Type', 'High'); $ Userfield = $ user- & gt; $ Field name; // $ Calculate Rank ($ ordertype == "less") {$ _CB_database- & gt; SetQuery (#__comprofiler WHERE from `SELECT COUNT (` id`), `$ field name` & lt; $ userfield and 'confirmation' = 1 and` approved '= 1');} and {$ _CB_ database-> #__comprofiler from SELECT COUNT (`id`) where '$ field name' & gt; $ user field and 'confirmation' = 1 and 'accepted' = 1");} $ Value = $ _CB_ database-> loadResult () + 1; Switch ($ output) {case 'html': case 'rss': $ oReturn = $ value; break; case 'htmledit': // $ oReturn = parent :: getField ($ field, $ user, $ output, $ Reason, $ list_compare_types); $ OReturn = null; // TBD for any search now ... anyway is not optimal in SQL. Case 'PHP': Case 'XML': Case 'XML': Case 'CSV header': Case 'fieldlist': Case 'CSV': Default: $ oReturn = $ this- & gt; _formatFieldOutputIntBoolFloat ($ Field-> Name , $ Value, $ output); break;} return $ return;}} / end of the rank field? & Gt;
Try it out.
// Calculate the rank if ($ ordertype == "less") {$ _CB_database- & gt; #__comprofiler WHERE from setclin ("SELECT COUNT (` id`) ". $ Namename." & Lt; '". $ Userfield."' And 'confirmation' = 1 and `approved '= 1"); } Else {$ _CB_database-> #__comprofiler WHERE from "SELECT COUNT (` id`) ". $ Namename." & Gt; ''. $ Userfield. '' And 'confirmation' = 1 and 'approved' = 1 "); } $ Value = $ _CB_ Database-> LoadResult () + 1;
Comments
Post a Comment