Skip to forum content

LuxCal Web Calendar

The place for news, questions and suggestions

You are not logged in. Please login or register.


Post new reply

LuxCal Web Calendar → Problems → Bug in MySQL Version?!?! → Post new reply

Post new reply

Compose and post your new reply

You may use: BBCode Images Smilies

All fields with bold label must be completed before the form is submitted.

Required information for guests


Required information

Topic review (newest first)

4

Hi Stefan,
I was very sure, but not anymore neutral
I guess you are right, for MySQL it should be LAST_INSERT_ID(). Strange that MySQL does not produce an SQL error.
I further investigated this problem and found out that when editing a single occurrence of a repeating or multi-day event and selecting the Save button (so without closing the Event window) and thereafter changing the same event failed because the event ID of the event was not available.
The dbLastRowId() function solves this problem.
Very good that you found this error !
Roel

3

Hi Roel,
are you very sure?
I'm really not good in coding, but google tells me, that "last_insert_rowid()" belongs to SQlite. For Mysql it would be "LAST_INSERT_ID()" ?

Anyway - while I was trying to get my own code working last_insert_rowid() allways returns nothing but dbLastRowId() givs me the correct ID ... - or I was doing something wrong hmm

But for me everything is working now - so thanks for your reply!

2

Hi Stefan,

It's not a bug. The code . . .

$stH = stPrep("SELECT last_insert_rowid()");
$row = $stH->fetch(PDO::FETCH_NUM);
$stH = null;
$eid = $row[0]; //set id to new event

has the same effect as . . .

$stH = null;
$eid = dbLastRowId(); //set id to new event

However, since the function dbLastRowId() is already used some 18 lines up, I agree - for consistency reasons - it would be better to use this function. I will change this for LuxCal v4.6.1.

The purpose of the code is the following:
When a user chooses to edit one specific occurrence of a repeating (or multi-day) event, then this occurrence will be removed from the repeating (or multi-day) event and a new event will be created to replace the removed occurrence. The code to get the ID of the last added row makes the newly added event the currently active event.

Thanks for reporting this,
Roel

1

Hi,
I am not very sure, but I think that there ist some wrong code in "pages/event.php" on line 410-413 in the MySQL version of Luxcal.
Shouldn't it be "$eid = dbLastRowId();" instead?

By the way - what is the code good for? Because everything seems to function correct. I only noticed this because I inserted some code for my special use of luxcal...

Greetings

   Stefan

LuxCal Web Calendar → Problems → Bug in MySQL Version?!?! → Post new reply