XpertWorlock Posted September 8, 2008 Share Posted September 8, 2008 $Content = (" <?php include 'siteLayout.php'; $con = mysql_connect('localhost:2222',"******","********"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("*********", $con); $result = mysql_query("SELECT * FROM users"); while($row = mysql_fetch_array($result)) { echo $row['userName']; } mysql_query(\"INSERT INTO users (userName, userPassword, userEmail) VALUES ('$signUpName', '$signUpPassword', '$signUpEmail')\"); echo \"<table border='1'><tr><td> Your account has been activated.<br><br>Please log in. </td></tr></table>\"; ?> \r\n"); $handle = fopen($fileName, 'x+'); fwrite($handle, $Content); fclose($handle); $con = mysql_connect('localhost:2222',"*******","*********"); This is the part of code where the error comes up. "Unexpected T_STRING." $Content is the content of the php file being written. Help is appreciated, I've tried everything I could think of. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted September 8, 2008 Share Posted September 8, 2008 You can't use double quotes inside of double quotes. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 8, 2008 Share Posted September 8, 2008 You can't use double quotes inside of double quotes. Well, you can, but not without escaping them... so you shouldn't. Quote Link to comment Share on other sites More sharing options...
XpertWorlock Posted September 8, 2008 Author Share Posted September 8, 2008 $Content = (" <?php include 'siteLayout.php'; $con = mysql_connect('localhost:2222','*****','********'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db('********', $con); $result = mysql_query("SELECT * FROM users"); while($row = mysql_fetch_array($result)) { echo $row['userName']; } mysql_query("INSERT INTO users (userName, userPassword, userEmail) VALUES ('$signUpName', '$signUpPassword', '$signUpEmail')\"); echo \"<table border='1'><tr><td> Your account has been activated.<br><br>Please log in. </td></tr></table>\"; ?> \r\n"); $handle = fopen($fileName, 'x+'); fwrite($handle, $Content); fclose($handle); Sorry I was copying an example of the code, I actually just use a function, so I now copied the official function. Again it's $result = mysql_query("SELECT * FROM users"); that gives the T_STRING error thanks for the replies so far Quote Link to comment Share on other sites More sharing options...
XpertWorlock Posted September 8, 2008 Author Share Posted September 8, 2008 Nevermind, I found out double quotes, even when used with care, can end up biting you in the ass. In this case, it was functions within other things, the functions contained double quotes and messed everything up. Quote Link to comment 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.