Jump to content

Recommended Posts

Hi Guys...
I've been setting a user system in sessions which is:
$user = $_POST['user'];
$_SESSION['LoggedIn'] = true;
$_SESSION['username'] = $user;

with all the other codes as well. Then I have my sessions code to check int he user is logged in by:
$LoggedIn = $_SESSION['LoggedIn'];
$usrname = $_SESSION['username'];

when I use codes like welcome $usrname I get this:
welcome Array.
Any ideas how I can get the username session to set the username and then retrieve this?
Link to comment
https://forums.phpfreaks.com/topic/13736-mysql_fetch_arraysql-problems/
Share on other sites

Nope this has only worked when echoing:
welcome $username.

How would I make the array to place it into an SQL Query,
[code=php:0]include "db.php";
$result = mysql_query("SELECT * FROM pm WHERE sendto='$_SESSION['username']'");
while($data2 = @mysql_fetch_row($result)){
$stats = $data2[7];
if($stats=="0"){
$new="<img src='images/new.jpg'>";
}
}[/code]
I have one problem:
[code=php:0]$query = "UPDATE accounts SET mail='".strtolower($_POST['newemail'])."' WHERE user='".strtolower({$_SESSION['username']['user']})."'" or die(mysql_error());[/code]

I get:
Parse error: syntax error, unexpected '{', expecting ')' in ./Zone/Account/Reset_email.php on line 172

Line 172:
[code=php:0]$query = "UPDATE accounts SET mail='".strtolower($_POST['newemail'])."' WHERE user='".strtolower({$_SESSION['username']['user']})."'" or die(mysql_error());
[/code]
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.

Guest
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.