Session Values Change
| From: | Jacob Hackamack | Date: | Wed, 28 Jul 2004 03:21:18 +0000 |
| Subject: | Session Values Change | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-35473@lists.php.net to get a copy of this message | ||
Hello,
I am trying to start a blog page where the person selects their person they
want to view (bottom of the page) and then it somehow changes the session
variable (top of the code) and then accesses the database. I was wondering,
what is the correct way to do something like this. I have tried a couple of
options (a hrefs) but they didn¹t seem to work and was wondering if anybody
had any suggestions.
Thank You In Advance
Jacob
<?php
session_start();
if (! isset($_SESSION['view']))
{
$_SESSION['view'] = "Jacob";
}
?>
#FORMATTING CODE HERE
$dbuser='php' ;
$dbpass='';
$dbhost='localhost';
$conn = mysql_connect ( $dbhost , $dbuser , $dbpass );
//mysql_select_db ( "web" );
$sql = 'Select UNIX_TIMESTAMP(date) AS
date,title,article from web.blog where user="'.$view.'" order by date desc
LIMIT 10';
$result = mysql_query($sql);
//Execute For Future Use: SELECT
DATE_FORMAT(date,'%W, %D %M, %Y %l:%i%p') content FROM blog
while ( $dataRow = mysql_fetch_row ( $result ) ) {
$date=date("F dS Y h:i:s A", $dataRow[0]);
echo '<a name="'.$date.'"></a>';
echo ' <div class="date">'.$date.
'</div>';
echo ' <h3>'.$dataRow[1].'</h3>';
echo ' <p>'.$dataRow[2].'</p><br>';
#echo $sql ;
}
mysql_close ( $conn );
#FORMATTING CODE HERE
<div id="footer">
<p>
Other Users:
<br>
Jacob Hackamack | Julie Hackamack | David Hackamack</p>
</div>