blink359 Posted November 20, 2010 Share Posted November 20, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/219314-small-error-with-while-loop/ Share on other sites More sharing options...
Pikachu2000 Posted November 20, 2010 Share Posted November 20, 2010 Had some extra/unnecessary concatenation on this line . . . <div id="rightleft"><?php echo"Name: {$row['Name']}"; ?></div><div id="rightright"><?php echo"Email: {$row['Email']}<br>"; ?></div> Quote Link to comment https://forums.phpfreaks.com/topic/219314-small-error-with-while-loop/#findComment-1137248 Share on other sites More sharing options...
blink359 Posted November 20, 2010 Author Share Posted November 20, 2010 Still Parse error: syntax error, unexpected T_STRING in /home/a9855336/public_html/261/cadetinfo.php on line 48 Quote Link to comment https://forums.phpfreaks.com/topic/219314-small-error-with-while-loop/#findComment-1137251 Share on other sites More sharing options...
Pikachu2000 Posted November 20, 2010 Share Posted November 20, 2010 I get no parse errors when I run that code with the edited line. Post your current version of the code please. Quote Link to comment https://forums.phpfreaks.com/topic/219314-small-error-with-while-loop/#findComment-1137252 Share on other sites More sharing options...
blink359 Posted November 20, 2010 Author Share Posted November 20, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/219314-small-error-with-while-loop/#findComment-1137254 Share on other sites More sharing options...
Pikachu2000 Posted November 20, 2010 Share Posted November 20, 2010 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(); Quote Link to comment https://forums.phpfreaks.com/topic/219314-small-error-with-while-loop/#findComment-1137257 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.