Re: An annoying session problem
| From: | Alex Major | Date: | Mon, 19 Jun 2006 16:05:48 +0000 |
| Subject: | Re: An annoying session problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238299@lists.php.net to get a copy of this message | ||
Thanks for pointing that out, however I've changed the code to:
<?php
// Lets see how much the person has at the moment.
$current_resource_query = "SELECT food, wood, stone, gold, population
FROM game_resources WHERE user_id = '".$_SESSION['user_id']."'";
$current_resource_result = mysql_query($current_resource_query);
$current_resource = mysql_fetch_assoc($current_resource_result);
?>
<table width="100%" cellspacing="1" cellpadding="1">
<tr>
<td colspan="5"><?php echo $_SESSION['username'] ?></td>
</tr>
<tr>
<td width="20%">Food: <?php echo $current_resource['food']
?></td>
<td width="20%">Wood: <?php echo $current_resource['wood']
?></td>
<td width="20%">Stone: <?php echo $current_resource['stone']
?></td>
<td width="20%">Gold: <?php echo $current_resource['gold']
?></td>
<td width="20%">Session user_id is: <?php echo $_SESSION['user_id']
?></td>
</tr>
</table>
And I'm still not getting the output correctly.
I don't think that the SELECT query is working properly, is there problem
with how I've put:
WHERE user_id = '".$_SESSION['user_id']."'
Regards,
Alex.
On 19/6/06 16:51, "phpninja" <phpninja@gmail.com> wrote:
> <td colspan="5"><?php $userid ?> <?php
> $_SESSION['username'] ?></td>
>
> that should be <?= $_SESSION['username'] ?> or <?php echo
> $_SESSION['username']; ?>
>
> its all in how you call the variables.. <?php $somevar ?> isint telling the
> variable to do anything.
>
> -phpninja