Use base_url() function inside a jQuery script
1. In the template.php view or in your current view define a global variable in script:
With base_url you get the root url of your website.
2. Use the CI_ROOT in any js file to get the root url.
For example, in a jquery - ajax call:
...
$.post(CI_ROOT + 'bookings/updBooking_ByAjax', data, function(res){
alert(res);
...
<script type="text/javascript">
CI_ROOT = "<?php echo(base_url());?>";
</script>
With base_url you get the root url of your website.
2. Use the CI_ROOT in any js file to get the root url.
For example, in a jquery - ajax call:
...
$.post(CI_ROOT + 'bookings/updBooking_ByAjax', data, function(res){
alert(res);
...
MySQL - How to create a calendar table
1. Create the table
CREATE TABLE `calendar` (
`cdate` date NOT NULL DEFAULT '2000-01-01',
`cday` int(2) unsigned NOT NULL DEFAULT '1',
`cmonth` int(2) unsigned NOT NULL DEFAULT '1',
`cyear` int(4) unsigned NOT NULL DEFAULT '2000',
PRIMARY KEY (`cdate`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2. Create an auxiliary table ints (0-9)
CREATE TABLE ints (i INTEGER);
INSERT INTO ints VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
3. Fill your calendar with dates from 01-01-2005 until 31-12-2030
INSERT INTO calendar (cdate, cday, cmonth, cyear)
SELECT cal.date as cdate, DAY(cal.date) as cday, MONTH(cal.date) as cmonth, YEAR(cal.date) as cyear
FROM (
SELECT '2005-01-01' + INTERVAL d.i*1000 + c.i* 100 + a.i * 10 + b.i DAY as date
FROM ints a JOIN ints b JOIN ints c JOIN ints d
ORDER BY d.i*1000 + c.i*100 + a.i*10 + b.i) cal
WHERE cal.date BETWEEN '2005-01-01' AND '2030-12-31'
Note: The above fourth join generates up to 10000 dates. In case you need more dates, add extra joints of the table 'ints'
CREATE TABLE `calendar` (
`cdate` date NOT NULL DEFAULT '2000-01-01',
`cday` int(2) unsigned NOT NULL DEFAULT '1',
`cmonth` int(2) unsigned NOT NULL DEFAULT '1',
`cyear` int(4) unsigned NOT NULL DEFAULT '2000',
PRIMARY KEY (`cdate`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2. Create an auxiliary table ints (0-9)
CREATE TABLE ints (i INTEGER);
INSERT INTO ints VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
3. Fill your calendar with dates from 01-01-2005 until 31-12-2030
INSERT INTO calendar (cdate, cday, cmonth, cyear)
SELECT cal.date as cdate, DAY(cal.date) as cday, MONTH(cal.date) as cmonth, YEAR(cal.date) as cyear
FROM (
SELECT '2005-01-01' + INTERVAL d.i*1000 + c.i* 100 + a.i * 10 + b.i DAY as date
FROM ints a JOIN ints b JOIN ints c JOIN ints d
ORDER BY d.i*1000 + c.i*100 + a.i*10 + b.i) cal
WHERE cal.date BETWEEN '2005-01-01' AND '2030-12-31'
Note: The above fourth join generates up to 10000 dates. In case you need more dates, add extra joints of the table 'ints'
INSERT INTO WHERE NOT EXISTS
If you want to insert values into a MySQL table, but only if those values don’t already exist, and you don’t want to use a primary key on the table (and deal with the resulting error suppression ), here’s an elegant one-query method of doing so.
INSERT INTO [table name] SELECT '[value1]', '[value2]' FROM DUAL
WHERE NOT EXISTS(
SELECT [column1] FROM [same table name]
WHERE [column1]='[value1]'
AND [column2]='[value2]' LIMIT 1)
OK, technically it’s not a single query.
But it is only one round trip to the MySQL server.
INSERT INTO [table name] SELECT '[value1]', '[value2]' FROM DUAL
WHERE NOT EXISTS(
SELECT [column1] FROM [same table name]
WHERE [column1]='[value1]'
AND [column2]='[value2]' LIMIT 1)
OK, technically it’s not a single query.
But it is only one round trip to the MySQL server.
ALIANTHOS BEACH HOTEL IN PLAKIAS, CRETE
WELCOME TO ALIANTHOS BEACH HOTEL IN PLAKIAS, CRETE
Welcome to Alianthos Beach Hotel, our small charming family-run hotel that is located in the traditional village of Plakias, and enjoy the sunny and beautiful Crete, an island of unique and unforgettable experiences.
Our hotel has been a favourite for tourists for more than 25 years, offering a cosy, relaxing and truly memorable holiday and perfectly combines the traditional Cretan style with modern comfort and convenience.
The hotel is famous for its ideal position, on the sea-front road of the village overlooking the crystal waters of the amazing sandy beach of Plakias, the breath-taking view to the Plakias bay and the Livyan Sea, the hospitality and the high-quality accommodation services. All of them in combination to the reasonable prices, making our hotel very attractive to our guests.
We invite you in our hotel to experience the cretan hospitality, to share the culture and the history of our place, to explore the friendly villages of south Crete, to enjoy the beautiful beaches, the bustling cities with nightlife and shopping and the holiday activities such as sea sports, trekking, countryside and mountain walks.
Technologies: HTML, CSS, PHP, mySQL
ANTHOS APARTMENTS IN PLAKIAS, CRETE
Welcome to Anthos Apartments, an amazing small group of apartments that is located in Plakias, a picturesque traditional village in the southern coast of Crete.
Our family-run apartments offer charming self-catering accommodation for your holidays in Crete in a cosy, comfortable and fully-equipped environment. The swimming pool, the big balconies and the amazing garden with flowers and trees can become an ideal solution for quiet and relaxing holidays away from the noise of the city and a guaranty for unforgettable holidays.
Anthos apartments are located on the top of a small hill, in a walking distance (500 meters) away from the beautiful sandy beach of Plakias and offer to our guests an amazing sea-view to the Plakias Bay, the villages and the hills around.
We invite you in our apartments to experience the Cretan hospitality, to share the culture and the history of our place, to explore the friendly villages of south Crete, to enjoy the beautiful beaches, the bustling cities with nightlife and shopping and the holiday activities such as sea sports, trekking, countryside and mountain walks.
Technologies: HTML, CSS, PHP, mySQL
Subscribe to:
Posts (Atom)