Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Intro Black Friday Offer for a lifetime*

error in SQL syntax

  • mahmoodee
  • mahmoodee
  • OFFLINE
  • Posts: 27
  • Thanks: 1
  • Karma: 0
10 years 3 weeks ago #252218 by mahmoodee
error in SQL syntax was created by mahmoodee
Hello,
I use joomla 2.5.27 and community builder 2.0.2.
I use cb rank plugin for community builder , it work fine but now I get error

I get error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND `confirmed` = 1 AND `approved` = 1' at line 1 SQL=SELECT COUNT(`id`) FROM r2yze_comprofiler WHERE `cb_points` > AND `confirmed` = 1 AND `approved` = 1

php code
Code:
// Calculate rank if ( $ordertype == "low" ) { $_CB_database->setQuery( "SELECT COUNT(`id`) FROM #__comprofiler WHERE `$fieldname` < $userfield AND `confirmed` = 1 AND `approved` = 1" ); } else { $_CB_database->setQuery( "SELECT COUNT(`id`) FROM #__comprofiler WHERE `$fieldname` > $userfield AND `confirmed` = 1 AND `approved` = 1" ); } $value = $_CB_database->loadResult() + 1;


How I can solve this error
thank you.

Please Log in or Create an account to join the conversation.

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
10 years 3 weeks ago #252221 by nant
Replied by nant on topic error in SQL syntax
WHERE `cb_points` > ??? AND `confirmed` = 1 AND `approved` = 1

Please Log in or Create an account to join the conversation.

  • mahmoodee
  • mahmoodee
  • OFFLINE
  • Posts: 27
  • Thanks: 1
  • Karma: 0
10 years 3 weeks ago - 10 years 3 weeks ago #252224 by mahmoodee
Replied by mahmoodee on topic error in SQL syntax
I cannot understand what did you mean
WHERE `cb_points` > ??? AND `confirmed` = 1 AND `approved` = 1
I attach php file
please help me

File Attachment:

File Name: cb.rankfield.zip
File Size:1 KB
Attachments:
Last edit: 10 years 3 weeks ago by mahmoodee.

Please Log in or Create an account to join the conversation.

  • mahmoodee
  • mahmoodee
  • OFFLINE
  • Posts: 27
  • Thanks: 1
  • Karma: 0
10 years 3 weeks ago #252229 by mahmoodee
Replied by mahmoodee on topic error in SQL syntax
I find the problem but no solution.
the problem is: when cb_points contains an empty String so generated SQL statement is wrong.
How I can solve this problem.
thank you

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum