Jump to content

Parse error message


boulepick

Recommended Posts

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);

Link to comment
https://forums.phpfreaks.com/topic/193811-parse-error-message/
Share on other sites

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"

Link to comment
https://forums.phpfreaks.com/topic/193811-parse-error-message/#findComment-1020062
Share on other sites

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);

Link to comment
https://forums.phpfreaks.com/topic/193811-parse-error-message/#findComment-1020411
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/193811-parse-error-message/#findComment-1021016
Share on other sites

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);
}

 

 

Link to comment
https://forums.phpfreaks.com/topic/193811-parse-error-message/#findComment-1021021
Share on other sites

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);

}

Link to comment
https://forums.phpfreaks.com/topic/193811-parse-error-message/#findComment-1021055
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.