• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

PHP Question, if you know anything about PHP, try and help me please

WarDemon666

Platinum Member
Heres the problem, im trying to fetch a particular user's information. But it doesnt keep it throughout the script. I cannot use a while loop all the way till the end of the script or i get a parse error. This is a bit what it looks like:

$getuser = @mysql_query("SELECT id, username, password, email, secret_question, secret_answer, name, age, sex, address, phone_num, icq, active FROM useraccounts WHERE username='$username'");

if (!$getuser) {
echo("Error performing query: " . mysql_error() . "");
exit();
} else {

while ($row = mysql_fetch_array($getuser)) {
if(@$row[active] == 'no') {



and then i close the while loop when im done. When i need the "$row[username]" later on in the script, i cant get it! I tried using another query, but then i would need another form. Im absolutly clueless of what i could do. How could i put the username, so its fixed throughout the script once someone logs in?

I have so many if statements in my script i dont know whats what. Is there a good php editor with colors? Something that could math each bracket with color?

Thanks for all your help, 🙂
Carl
 
<?
session_start(); // start a session
$username = $row[username];
session_register("username"); // register $username as a session variable
?>

to gain access to value stored in $username in other scripts during the same session,

<?
session_start();

echo "The current user is $username";
?>

Session is only available with PHP 4 or newer versions.
 
Back
Top