TOPIC:

Database queries 1 month 2 weeks ago #247803

  • Topic Author
  • ooc
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 231
  • Thanks: 1
Thanks Markus
I have used your echo statement (I was trying to get some output earlier but was missing the 'exit' at the end).

What I have now is
$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));

echo "UPDATE `h8be5_eventregistration` 
SET `countnow` =   `countnow` + " . $db->quote($groupsize)
 . " WHERE `eventdate`  =  " .  $db->quote($eventdate) . "and `arrival` = " . $db->quote($arrival);
exit;
What I get back is
UPDATE `h8be5_eventregistration` SET `countnow` = `countnow` + '1' WHERE `eventdate` = '20200913'and `arrival` = '11:30-11:45'
It dis not update.
When I copy and paste it into phpMYADMIN it does update.

I will continue trying to get more information - using 1,2 variables with the echo but wanted to hopefully catch you today.

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

Database queries 1 month 2 weeks ago #247808

  • Topic Author
  • ooc
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 231
  • Thanks: 1
I have done some more tests and find that the variables come through into the sql just fine but the sql is not executed. I tried this with an insert statement with this code
$this->execPieceByName('ff_InitLib');

$arrival = ff_getSubmit('arrival');
$groupsize = ff_getSubmit('groupsize');
$eventdate = ff_getSubmit('eventdate');

$db = JFactory::getDbo();
  
 $db->setQuery("INSERT INTO `h8be5_eventregistration`(`eventdate`, `arrival`, `maximum`, `countnow`) VALUES ('20201004', '10:15-10:30', 15, 0)");

echo "INSERT INTO `h8be5_eventregistration`(`eventdate`, `arrival`, `maximum`, `countnow`) VALUES ('20201004', '10:15-10:30', 15, 0)";
exit;
This results in an echo of
INSERT INTO `h8be5_eventregistration`(`eventdate`, `arrival`, `maximum`, `countnow`) VALUES ('20201004', '10:15-10:30', 15, 0)
No variables at all but it was not executed from the form piece. The insert does work on phpMYADMIN.

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

Database queries 1 month 2 weeks ago #247829

  • Topic Author
  • ooc
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 231
  • Thanks: 1
Hi Marcus
I am down to the wire here . I have everything ready to go except this final db update. I really need this for Monday. If you need to get into our account to see why it does not finish, no problem. Just let me know where to send the sign-in information. If possible , could you look at this early Monday. You are 6 hours ahead of me, here in Canada. I will check at 5am, 11am your time and perhaps we can resolve this with some on the day exchanges.

Thanks
Lorna

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

Database queries 1 month 1 week ago #247909

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 803
Ok, now please compare how the dates in your acutal eventdate db column are stored.
You are handing over "20200913" but I doubt it is in the right format, should be rather like "2020-09-12" if it is a date type column.

Arrival could potentially have a similar issue.

Regards,
Markus

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

Database queries 1 month 1 week ago #247912

  • Topic Author
  • ooc
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 231
  • Thanks: 1
eventdate is not defined as a date type . It is char(8)
Arrival time is also char - in this case char(11)
copy and paste from phpmyAdmin - structure

1 eventdatePrimary char(8) utf8mb4_general_ci No Change Change Drop Drop
More More
2 arrivalPrimary char(11) utf8mb4_general_ci No Change Change Drop Drop
More More
3 maximum tinyint(4) No 15 Change Change Drop Drop
More More
4 countnow tinyint(4) Yes NULL Change Change Drop Drop
More More

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

Database queries 1 month 1 week ago #247918

  • Topic Author
  • ooc
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 231
  • Thanks: 1
Also I have set the following as my script - no variables eventdate, arrival time and groupsize all given values and it does not update
$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` + 3
WHERE `eventdate`  =  '20200913' and `arrival` = '11:15-11:30' ");

echo "UPDATE `h8be5_eventregistration` 
SET `countnow`= `countnow` + 3
 WHERE `eventdate`  =  '20200913' and `arrival` = '11:15-11:30'  ";
exit;

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

Time to create page: 0.051 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!