Having problems with user defined sessions using postgresql as my session manager - Mailing list pgsql-php

From Richmond Dyes
Subject Having problems with user defined sessions using postgresql as my session manager
Date
Msg-id 45095EB1.50707@monroehosp.org
Whole thread Raw
Responses Re: Having problems with user defined sessions using postgresql
List pgsql-php
I have written user defined session management library in php using postgresql as my session repository.  When I let
mysession timeout on my browser I get the below errors on my screen.<br /><br />    <b>Warning</b>: pg_query(): Query
failed:ERROR: duplicate key violates unique constraint "li_session_pkey" in
<b>/var/www/html/liberty/includes/session.php</b>on line <b>31</b><br /><br /><b>Fatal error</b>: Call to undefined
function:pg_error() in <b>/var/www/html/liberty/includes/session.php</b> on line <b>31</b><br /><br /><b>Warning</b>:
Unknown():A session is active. You cannot change the session module's ini settings at this time. in <b>Unknown</b> on
line<b>0<br /><br /> The problem is in the write function of my library. Here it is:<br /><br /> function
pg_session_write($sid,$val) {<br />     $life = get_cfg_var("session.gc_maxlifetime");<br />     $exp = time() +
$life;<br/>     $selQ = "SELECT sidid FROM li_session<br />     WHERE sidid = '$sid' AND exptime >". time();<br />
   $selR= pg_query($selQ)or die("It didn't work:". pg_error());<br />      if(pg_num_rows($selR)) {<br />        
$sesupQ="UPDATE li_session SET<br />         exptime = '$exp', vidval = '$val'<br />         WHERE<br />         sidid
='$sid' and exptime >". time();<br />         $sesupR=pg_query($sesupQ) or die("It didn't work:". pg_error());<br />
   } else {<br />      $sesinQ = "INSERT INTO li_session<br />     VALUES('$sid', '$val', '$exp')";<br />     $sesinR=
pg_query($sesinQ)or die("It didn't work:". pg_error());    <br />     }<br /> }<br /></b> 

pgsql-php by date:

Previous
From: "Nikolay Samokhvalov"
Date:
Subject: Re: binary cursor returning truncated data
Next
From: Erik Jones
Date:
Subject: Re: Having problems with user defined sessions using postgresql