Jump to content

mysql_fetch_array($sql); Problems...


xyn

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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.