This topic is locked
[SOLVED]

Event booking

10/12/2022 2:33:46 PM
PHPRunner General questions
H
hudster author

Hi all

It's been a few years since I last used PHPRunner for my last project, but I've just purchased 10.8 and loving the new features.

I'm creating a site for an online academy for our system of health providers. One thing I'm keen to do is to create a very simple event booking system to link to the events template - for example, for guest lectures or webinars. All events are free, so there is no need for a shopping cart. I have considered a simple sign up form. However, for some events places will be limited, so I'd like to record in the database table that an event has X number of spaces/tickets available. Once that limit is reached then no more bookings can be made (ie: the event is full).

I've had a look through the forums to see if anyone has done this, and cannot see any specific projects or answers. I'm wondering if there is a piece of code I could add to the "events" section of PHPR - so that once X number of records are added, no more records can be added for that event. I've seen the video tutorial on inventory management, but it seems a little complicated for what I need. I'm keen not to resort to eventbrite, so that we can keep the user data etc in house.

Thanks in advance for any inspiration!

H
hudster author 10/12/2022

Ignore me: there is a section in the PHP runner manual

I need to add something in the before record added event on the add page:

$limit = X;

$rs = DB::Query("select count(*) as c from bookings);
$data = $rs->fetchAssoc();
$count = $data["c"];

if ($count>= $limit)
{
echo "Sorry this event is now fully booked.";
exit();
}