Jump to content

small error with while loop


blink359

Recommended Posts

Hi there, just trying to make my while loop for echoing data look better but ive now got an error:

Parse error: syntax error, unexpected T_STRING in /home/a9855336/public_html/261/cadetinfo.php on line 48

and im not sure what ive done wrong here is my code, line 48 is marked

 

<?php
$fldtextArea_name = str_replace("<br>", "\n", $fldtextArea_name);
//connect to the databas
mysql_connect("m*******","a********_root","n*********");
mysql_select_db("m***********");

//add the email to from @valiantflight.co.uk
$from = $from."@valiantflight.co.uk";

//query database and pull email addresses    

$result = mysql_query("SELECT * FROM mail");
while ($row = mysql_fetch_array($result))
{
?>
48	<div id="rightleft"><?php echo('Name:'. $row['Name'] .'); ?></div><div id="rightright"><?php echo('Email:'. $row['Email'] .'<br>'); ?></div>

<?php
}
?> 

Any help would be very appriciated,

 

Thanks,

 

 

Blink359

Link to comment
Share on other sites

Sorry, my host is playing up its not been uploaded properly but it works now, thanks, also while im on the forum i have a login to a restricted area of the website and you have to log in to view the whole thing but im not sure how to destroy 1 session so that they log out of the restricted and go back to the main site, i tried using

<? 
session_start(myusername);
session_destroy(myusername);
header("location:index.php");
?>

to destroy the 2nd one but it also destroys the first one requiring users to log in again which is annoying,

 

 

Any ideas?

 

Blink359

Link to comment
Share on other sites

I assume you're using 2 different $_SESSION vars, one for general login and one for restricted access? You should be able to just unset() the one for restricted access.

 

// when authenticated for access . . .
$_SESSION['restricted_access'] = TRUE;

// when logging out of restricted area
session_start();
unset($_SESSION['restricted_access']);
header('location: index.php');
exit();

Link to comment
Share on other sites

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.