Session variables.
Posted: Fri Jul 22, 2011 10:56 am
Hi, learning as I go at the moment but getting unstuck.
I understand how to create a variable on a page and display it. The following sets the variable to 1:
and then this displays it on the page
That's nice and easy, but I need to be able to set the variable from an outside source, i.e my database. I'm using Dreamweaver and I thought having created a recordset with the record I want to pull in I would be able to use this code:
But it just gives me an undefined variables error, so clearly I'm missing something.
Can some help me understand what I need to do please to bring in a piece of data from the database, set this is the variable and then display this (or use it in an if statement, but I'll come on to that) within the page.
Many thanks,
Darren
I understand how to create a variable on a page and display it. The following sets the variable to 1:
Code: Select all
<?php
$current_game = 1;
?>Code: Select all
<p>Current game: <?php echo $current_game ?></p>Code: Select all
<?php
$dcurrent_game = $row_Current_game['current_game'];
?>Can some help me understand what I need to do please to bring in a piece of data from the database, set this is the variable and then display this (or use it in an if statement, but I'll come on to that) within the page.
Many thanks,
Darren