boulepick Posted March 1, 2010 Share Posted March 1, 2010 Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\www\myserver.dev\public_html\...........\install\install.php on line 49 can anyone help figure out what is wrong with that coding 46 if ($fp) 47 { 48 $content = "<?php \n" 49 " \n" 50 "/* Database Host Name */ \n". 51 "\$db_host = '" . $post_details['db_host'] . "'; \n". 52 " \n". 53 "/* Database Username */ \n". 54 "\$db_username = '" . $post_details['db_username'] . "'; \n". 55 " \n". 56 "/* Database Login Password */ \n". 57 "\$db_password = '" . $post_details['db_password'] . "'; \n". 58 " \n". 59 "/* Database and Session prefixes */ \n". 60 "define('DB_PREFIX', '" . $post_details['table_prefix'] . "'); ## Do not edit ! \n". 61 "define('SESSION_PREFIX', 'probid_'); \n". 62 " \n". 63 "/* Database Name */ \n". 64 "\$db_name = '" . $post_details['db_name'] . "'; \n". 65 "?>"; 66 67 fputs($fp, $content); 68 fclose($fp); Quote Link to comment https://forums.phpfreaks.com/topic/193811-parse-error-message/ Share on other sites More sharing options...
aeroswat Posted March 1, 2010 Share Posted March 1, 2010 Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\www\myserver.dev\public_html\...........\install\install.php on line 49 can anyone help figure out what is wrong with that coding 46 if ($fp) 47 { 48 $content = "<?php \n" 49 " \n" 50 "/* Database Host Name */ \n". 51 "\$db_host = '" . $post_details['db_host'] . "'; \n". 52 " \n". 53 "/* Database Username */ \n". 54 "\$db_username = '" . $post_details['db_username'] . "'; \n". 55 " \n". 56 "/* Database Login Password */ \n". 57 "\$db_password = '" . $post_details['db_password'] . "'; \n". 58 " \n". 59 "/* Database and Session prefixes */ \n". 60 "define('DB_PREFIX', '" . $post_details['table_prefix'] . "'); ## Do not edit ! \n". 61 "define('SESSION_PREFIX', 'probid_'); \n". 62 " \n". 63 "/* Database Name */ \n". 64 "\$db_name = '" . $post_details['db_name'] . "'; \n". 65 "?>"; 66 67 fputs($fp, $content); 68 fclose($fp); You need to add a concatenation operator, in other words a period, after your "\n" Quote Link to comment https://forums.phpfreaks.com/topic/193811-parse-error-message/#findComment-1020062 Share on other sites More sharing options...
boulepick Posted March 2, 2010 Author Share Posted March 2, 2010 thank you for your response, i did add the period but still no luck and reporting the same parse error on line 49 46 if ($fp) 47 { 48 $content = "<?php \n" 49 " \n". 50 "/* Database Host Name */ \n". 51 "\$db_host = '" . $post_details['db_host'] . "'; \n". 52 " \n". 53 "/* Database Username */ \n". 54 "\$db_username = '" . $post_details['db_username'] . "'; \n". 55 " \n". 56 "/* Database Login Password */ \n". 57 "\$db_password = '" . $post_details['db_password'] . "'; \n". 58 " \n". 59 "/* Database and Session prefixes */ \n". 60 "define('DB_PREFIX', '" . $post_details['table_prefix'] . "'); ## Do not edit ! \n". 61 "define('SESSION_PREFIX', 'probid_'); \n". 62 " \n". 63 "/* Database Name */ \n". 64 "\$db_name = '" . $post_details['db_name'] . "'; \n". 65 "?>"; 66 67 fputs($fp, $content); 68 fclose($fp); Quote Link to comment https://forums.phpfreaks.com/topic/193811-parse-error-message/#findComment-1020411 Share on other sites More sharing options...
salathe Posted March 2, 2010 Share Posted March 2, 2010 It needs one after the end of $content = "<?php \n" as well. Quote Link to comment https://forums.phpfreaks.com/topic/193811-parse-error-message/#findComment-1020418 Share on other sites More sharing options...
boulepick Posted March 3, 2010 Author Share Posted March 3, 2010 i did add one period after the ( $content = "<?php \n" ) but still giving the same error. strange though that it would not pick-up on that one since it's on line 48 and reporting the error on line 49. i'm very lost here, is there something else that i am missing or not doing. thanks Quote Link to comment https://forums.phpfreaks.com/topic/193811-parse-error-message/#findComment-1021016 Share on other sites More sharing options...
wildteen88 Posted March 3, 2010 Share Posted March 3, 2010 You may find it more particle to use HEREDOC syntax: if ($fp) { $content = <<<PHPCODE <?php /* Database Host Name */ \$db_host = '{$post_details['db_host']}'; /* Database Username */ \$db_username = '{$post_details['db_username']}'; /* Database Login Password */ \$db_password = '{$post_details['db_password']}'; /* Database and Session prefixes */ define('DB_PREFIX', '{$post_details['table_prefix']}'); ## Do not edit ! define('SESSION_PREFIX', 'probid_'); /* Database Name */ \$db_name = '{$post_details['db_name']}'; ?> PHPCODE; fputs($fp, $content); fclose($fp); } Quote Link to comment https://forums.phpfreaks.com/topic/193811-parse-error-message/#findComment-1021021 Share on other sites More sharing options...
boulepick Posted March 3, 2010 Author Share Posted March 3, 2010 thanks for the reply but now i'm getting a different error: Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING in C:\www\myserver.dev\public_html\........\install\install.php on line 52 ## install related functions function create_config($post_details) { $fp = fopen('../includes/config.php', 'w'); if ($fp) { $content = <<<PHPCODE <?php /* Database Host Name */ \$db_host = '{$post_details['db_host']}'; =>Line 52 /* Database Username */ \$db_username = '{$post_details['db_username']}'; /* Database Login Password */ \$db_password = '{$post_details['db_password']}'; /* Database and Session prefixes */ define('DB_PREFIX', '{$post_details['table_prefix']}'); ## Do not edit ! define('SESSION_PREFIX', 'probid_'); /* Database Name */ \$db_name = '{$post_details['db_name']}'; ?> PHPCODE; fputs($fp, $content); fclose($fp); } Quote Link to comment https://forums.phpfreaks.com/topic/193811-parse-error-message/#findComment-1021055 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.