0
Folks I need a light to unwind a TIMESHEET.
I have the following code.
<form method="post" action="includes/input.php">
<button type="submit" class="btn btn-primary" onClick="send('login');" value="login" >Default</button>
<button type="submit" class="btn btn-primary" onClick="send('break');" value="break" >Default</button>
<button type="submit" class="btn btn-primary" onClick="send('breakout');" value="breakout" >Default</button>
<button type="submit" class="btn btn-primary" onClick="send('logout');" value="logout" >Default </button>
</form>
This form perfectly calls the pages. The problem is that the first Submit is an INSERT INTO that works perfectly by sending four dates to the bank via Mysqli with the NOW function().
$sql = "INSERT INTO registros (id, re, login, inbreak, outbreak, logout) VALUES ('', '$re', now(), now(), now(), now())";
The third column with the Now() function indicates the operator’s input time on the production line, the fourth column the break input and so on, I need help understanding how I perform the update of these columns, but I am unable to capture the ID to perform the update.
Follow the page code that would be for the update of the fourth column.
$id = mysqli_insert_id($link);
var_dump($id);$re = '';
$sql = "UPDATE registros SET breakin = NOW() WHERE id = $id;"
Thank you in advance.
I’ll try, thank you.
– user3275937
Test result. This command expects only one argument. Warning: mysqli_insert_id() expects Exactly 1 Parameter, 2 Given in /opt/lampp/htdocs/time/break.php on line 9
– user3275937
forgive me missed the function, you should only include the connection , nothing else. right after the command
mysqli_query($con,$sql);
you can do the$id = mysqli_insert_id($con);
– Jasar Orion
there was another post that I answered with the same problem as you: http://answall.com/questions/151395/pega-%C3%Baltimo-id-inserted-no-mysql-com-php
– Jasar Orion