Welcome, Guest

Select record: why not working ???
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Select record: why not working ???

Select record: why not working ??? 1 year, 5 months ago #16173

Hello
I need to select and count some records in one table. But for any reason, it odes not work. I check in different documents and post but I don't see my error.
Anyone to help me please?
function ff_verify_database (element, action)
{
   var value_name=ff_getElementByName('name').value;
   var value_surname=ff_getElementByName('surname').value;

   $row = ff_select("SELECT * FROM #__annuaire WHERE name=value_name AND surname=value_surname");

   if (count($row)!=0)
   {
      if (message=='') message = "You are already in the database.\n";
      ff_validationFocus(element.name);
      return message;
   }
}

Thank you in advance
  • frlobe
Last Edit: 1 year, 5 months ago by .

Re: Select record: why not working ??? 1 year, 5 months ago #16321

Hi! Seems like your SELECT statement is amiss. The literal string "value_name" and "value_surname" gets plugged into the statement, not the values they contain. Try this instead:

$row = ff_select("SELECT * FROM #__annuaire WHERE name='" + value_name + "' AND  surname='" + value_surname + "'");


You might also want to convert the values to uppercase before comparison.

HTH!
  • havoc
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Karma: 0

Re: Select record: why not working ??? 1 year, 5 months ago #16322

Hi! Seems like your SELECT statement is amiss. The literal string "value_name" and "value_surname" gets plugged into the statement, not the values they contain. Try this instead:

$row = ff_select("SELECT * FROM #__annuaire WHERE name='" + value_name + "' AND  surname='" + value_surname + "'");


You might also want to convert the values to uppercase before comparison.

HTH!
  • havoc
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Karma: 0

Re: Select record: why not working ??? 1 year, 5 months ago #16344

Hello
thank you for your answer.
I change the SELECT as you mention. But I receive an error:
Erreur : ff_select is not defined
Fichier Source : http://localhost/assoc/index.php?option=com_breezingforms&Itemid=29
Ligne : 974

What is strange is that I active ff_IniLib in my form, I copy the line in this script to activate ff_select
    $this->execPieceByName('ff_InitUtilities');
    $this->execPieceByName('ff_SubmitUtilities');
    if (!function_exists('ff_select')) $this->execPieceByName('ff_select');

I don't undestand why ff_select is not defined.

As per the uppercase, it is already included in my field with this:
function ff_field_action(element, action)
{
   ff_getElementByName('field').value = ff_getElementByName('field').value.toUpperCase();
} //ff_field_action

as both records and fields ar in the same format. And it works
Thank you
  • frlobe
  • Page:
  • 1
Moderators: TheMuffinMan, ForumSupport
Time to create page: 0.34 seconds

About

Crosstec GmbH & Co. KG

Bergisch-Gladbacher-Str. 829

51069 Cologne, Germany