DMXzone Server Connect Support Product Page
This topic is locked
SQL Question - Session Variable
Asked 17 Jun 2018 14:17:49
1
has this question
17 Jun 2018 14:17:49 David McCowan posted:
Dear Representative,Is there a way to use DMXZONE Server Connect to insert the following value into a Global Session variable?
$query = "SELECT MAX(ID) AS lastID FROM donations";
$result = mysqli_query( $con, $query ) or die();
$row = mysqli_fetch_assoc($result);
session_start();
$_SESSION[last_ID] = $row[lastID];
Replies
Replied 18 Jun 2018 06:39:11
18 Jun 2018 06:39:11 Teodor Kuduschiev replied:
Hi David,
Could you explain what are you trying to achieve?
Could you explain what are you trying to achieve?
Replied 18 Jun 2018 14:47:28
18 Jun 2018 14:47:28 David McCowan replied:
The code should have been,
$query = "SELECT MAX(batch) AS lastID FROM donations";
$result = mysqli_query( $con, $query ) or die();
$row = mysqli_fetch_assoc($result);
session_start();
$_SESSION[last_ID] = $row[lastID]
Sure, I want to obtain the last value from a number field named "batch" in a mysql database. I need that number when I create a new record. I can do that using php, but wasn't sure if I could do that with Server action.
$query = "SELECT MAX(batch) AS lastID FROM donations";
$result = mysqli_query( $con, $query ) or die();
$row = mysqli_fetch_assoc($result);
session_start();
$_SESSION[last_ID] = $row[lastID]
Sure, I want to obtain the last value from a number field named "batch" in a mysql database. I need that number when I create a new record. I can do that using php, but wasn't sure if I could do that with Server action.
Replied 19 Jun 2018 06:59:54
19 Jun 2018 06:59:54 Teodor Kuduschiev replied:
Hi David,
Yes that is possible. Not sure why would you need the session for the insert? Are you going to use it somewhere else on the page?
With the insert step in server connect you don't need a session.
Yes that is possible. Not sure why would you need the session for the insert? Are you going to use it somewhere else on the page?
With the insert step in server connect you don't need a session.