TOPIC:

Database queries 1 month 2 weeks ago #247566

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 803
Hi,

1) if groupsize is empty it basically means that it hasn't been transferred properly.
Either the actually parameter "groupsize" isn't specified in the calling ajax script and/or the ajax script is calling the PHP piece as GET method (using $_GET instead of $_POST on the PHP end).

2) It would rather look like this to pass that variable:
$db = JFactory::getDbo();
    $db->setQuery("UPDATE `h8be5_eventregistration` SET `countnow`= 8 WHERE `eventdate`='20200913' and `arrival` =  " . $db->quote($arrival))

3) Please check if the summary field is still connected with the actual field. Upon name changes it can happen they gonna lose the connection.

4) Please update the gdata plugin with the one from the latest downloads.
(after unzipping the main file, it is located in /extensions/addons/plg_gdata.zip)

5) In the advanced tabs of each you can hide the labels.

6) What error do you get? The sandbox can be quite nasty to test with. If you for example get an error that the payment couldn't be verified, it usually means that the sandbox test doesn't return back instant payment notifications to the server and it would usually work on their live system.

Regards,
Markus

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

Database queries 1 month 2 weeks ago #247701

  • Topic Author
  • ooc
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 231
  • Thanks: 1
Thank you Markus
Problems 1,3,4,5 and 6 are all good now.
For problem 2 - the final update of the database table - I can get the update done with a single form variable but cannot get the right syntax for using values of 3 form variables. I see ff_getSubmit will return a list (FF_LIST) of 3 but I can't figure out the syntax for that. Instead I tried 3 calls to ff_getSubmit with this code
[code $this->execPieceByName('ff_InitLib');
$arrival = ff_getSubmit(' arrival');
$groupsize = ff_getSubmit('groupsize');
$eventdate = ff_getSubmit('eventdate');

$db = JFactory::getDbo();

$db->setQuery("UPDATE `h8be5_eventregistration`
SET `countnow`= `countnow` + " . $db->quote($groupsize)
. " WHERE `eventdate = " . $db->quote($eventdate) . " and `arrival` =
" . $db->quote($arrival))[/code]
but that did not work - no errors but no update either.
Can you tell me how to structure this ff_getSubmit and setQuery ?
I am attaching the latest version of the form which contains the after submit piece above.

File Attachment:

File Name: eventregis...9-02.zip
File Size:49 KB
Attachments:

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

Database queries 1 month 2 weeks ago #247744

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 803
Hi,

I see 2 possibilities why it doesn't work, either "groupsize" is in fact a group element like checkboxgroup or multiple select list, if yes, then see the code below how to count this:
$this->execPieceByName('ff_InitLib');
$arrival = ff_getSubmit(' arrival');
$groupsize = count(ff_getSubmit('groupsize', FF_ARRAY));
$eventdate = ff_getSubmit('eventdate');

$db = JFactory::getDbo();

$db->setQuery("UPDATE `#__eventregistration`
SET `countnow`= `countnow` + " . $db->quote($groupsize)
    . " WHERE `eventdate = " . $db->quote($eventdate) . " and `arrival` =
" . $db->quote($arrival));

Or it is a format/time issue with the eventdate.
By default date and datetime are either "YYYY-MM-DD" or "YYYY-MM-DD H:i:s".

If $eventdate doesn't follow these formats, they would never match in your where clause. Also, if you are using datetime, and do an exact match with "=" then 1 second is already enough for the query not to find nothing (then it would make sense to use greater and smaller than).

Regards,
Markus

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

Database queries 1 month 2 weeks ago #247751

  • Topic Author
  • ooc
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 231
  • Thanks: 1
Groupsize is number input min. 1, max 6
Event date is a select from list
1;Select event date;Select event date
0;20200913;20200913
0;20200920;20200920
0;20200927;20200927 [/]
I only want the one value from eventdate.  I have tried with the following  giving a constant for eventdate to see if the other 2 would work
[code]
$this->execPieceByName('ff_InitLib');
$arrival = ff_getSubmit(' arrival'); 
$groupsize = ff_getSubmit('groupsize');
$db = JFactory::getDbo();
 $db->setQuery("UPDATE `h8be5_eventregistration` 
SET `countnow`= `countnow` + " . $db->quote($groupsize)
. "  WHERE `eventdate`  = '20200913' and `arrival` = " . $db->quote($arrival))
but got message '0 - Call to a member function getListFeed() on null'

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

Database queries 1 month 2 weeks ago #247754

  • Topic Author
  • ooc
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 231
  • Thanks: 1
Sorry . Quick update on that. That message seems to have something to do with the Google Spreadsheet which was working but I have added some fields and it isn't working now. I reset it so it is no longer , I believe, being called and now with that After form piece I get no error message but it still doesn't update the database.

Lorna

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

Database queries 1 month 2 weeks ago #247795

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 803
Then let's check the SQL string that's being used first:

Please add this at the end of your code
echo "UPDATE `h8be5_eventregistration` 
SET `countnow`= `countnow` + " . $db->quote($groupsize)
. "  WHERE `eventdate`  = '20200913' and `arrival` = " . $db->quote($arrival);
exit;

This should show you a white page with the actual query being used.
Copy and paste this query and execute it as SQL in phpmyadmin and see what the outcome/message is.

Also please post the resulting query here, too. I am pretty sure it has something to do with the where clause and data not matching.

Regards,
Markus

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

Time to create page: 0.054 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!