solon Posted March 27, 2009 Share Posted March 27, 2009 Hey guys i have a problem when using 'session_regenerate_id();' . i have the following code... <?php putenv("TZ=EET"); session_start(); $session_id = session_id(); session_regenerate_id(); //regenerate session id $session = session_id(); echo $session_id."</br>"; echo $session."</br>"; $today = date("Y-m-d"); $time15 = mktime(date("H"),date("i")); $time = date("H:i",$time15); //Array to store validation errors $errmsg_arr = array(); //Validation error flag $errflag = false; //Connect to mysql server $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die('Failed to connect to server: '.mysql_error()); //Select database $db = mysql_select_db(DB_DATABASE) or die("Unable to select database. ".mysql_error()); $upd_lott = mysql_query("UPDATE `tbl` SET `confirmed` = 'y', `session_id` = '$session' WHERE `session_id` = '$session_id' && `confirmed` = 'N'") or die ("Update error: ".mysql_error()); $resrow = mysql_query("SELECT * FROM `tbl` WHERE `session_id` = '$session'") or die(mysql_error()); $ola = mysql_num_rows($resrow); echo $ola."</br>"; echo $session."</br>"; // i echo the session variable again here so i can see if it changes but its the same. if ($ola >= 1) { while($row_p = mysql_fetch_array($resrow)) { $num_rows1 += $row_p[amount_paid]; } $guar_check_get = mysql_query("") or die (mysql_error()); ?> <script type="text/javascript"> opener.location.reload(); opener.location.reload(); window.close(); </script> <?php } else { echo "No rows"; exit(); } ?> Now the problem is the following, if you see the code there is an 'update' query and after that a select query. Both looking at the same table. They are both executing with no errors but still the select query(the second) does not return anything when it should return the rows that where updated from the last query... Please check it out and let me know if you see something cause i cant. Thanks in advance Link to comment https://forums.phpfreaks.com/topic/151394-session-regenerate-problem/ Share on other sites More sharing options...
solon Posted March 27, 2009 Author Share Posted March 27, 2009 Nothing?? Please its really urgent... if you need any further info please let me know Link to comment https://forums.phpfreaks.com/topic/151394-session-regenerate-problem/#findComment-795275 Share on other sites More sharing options...
ober Posted March 27, 2009 Share Posted March 27, 2009 Are you sure it is updating? I personally have never seen a DB take && for AND in a where clause. Link to comment https://forums.phpfreaks.com/topic/151394-session-regenerate-problem/#findComment-795304 Share on other sites More sharing options...
solon Posted March 27, 2009 Author Share Posted March 27, 2009 it does take it, but anyway i thought of that and changed it but its still the same. I am sure it is updating because when i 'echo' the query it has the correct values. i dont know why this is happening Link to comment https://forums.phpfreaks.com/topic/151394-session-regenerate-problem/#findComment-795359 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.