0

Hi,

As the title states, within my files require_once is not working as intended.

I have a file where a user enters booking details and at the top it requires once the file to create the database and insert initial data into it.

The problem is it seems to be requiring it everytime, not just once.

For instance, i enter a booking and it goes into the database fine. When i revisit the booking page again, it requires that file again thus erasing the previous booking and adds the new booking. Ideally, the database should not be recreated and initialised again and there should be two new bookings rather than one.

I'm not sure why the require_once command is requiring the file more than once? Any Ideas?

Thanks.

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by broj1
0

It will be included just once for the duration of your script. Reloading the page restarts the script, thus including the file.

0

Is there any way i can get it to be included just once?

0

In the included file check whether the data (and database) exist and if not add records (otherwise do nothing). Or in your primary fle check whether the data exists and if not then include the file.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.