Problems with sessions

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Georgezx9
New php-forum User
New php-forum User
Posts: 9
Joined: Mon Mar 31, 2014 1:15 pm

Problems with sessions

Postby Georgezx9 » Wed Apr 23, 2014 2:11 pm

Hi I am trying to pass variables between pages, does the session logic only work between the next page called or all pages.

I have a variable on page 1 (actually a column value from SQL query-$result['ID']):

Code: Select all

session_start();
$_SESSION['thisblogno'] = $result['ID'];

Page 2 does not use the variable but, page 2 calls page 3, where I have:

Code: Select all

session_start();
$thisblogno=$_SESSION['thisblogno'];
$query="INSERT INTO blogs (BlogText,Bloggerid) VALUES ('$text','$thisblogno')";


The code works except the 2nd sql column value is always zero

Grateful for any help.

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest