Jump to content

session regenerate problem


Recommended Posts

Hey guys i have a problem when using 'session_regenerate_id();' .

i have the following code...


$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">
	echo "No rows";


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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.