On Thu, 21 Jun 2001, Romulo Roberto Pereira wrote:
> Hello!
>
> The following give me: unterminated string constant (this is a javascript
> error)
>
> when I execute the following:
>
> while ($row = mysql_fetch_array ($data_query_action)) {
> $data_data = $row["data_data"];
> }
> echo "<script language=\"javascript\">\n var
> ndata=\"".addslashes($data_data)."\";\nPutCode (ndata);\n</script>";
>
> Ideas? Please I need help.
>
> Thank you,
>
This is usually a problem where a string literal is spanning thru several
lines. Remember, in JavaScript one statement ends either with a semi-colon
or a newline '\n'.
You should do str_replace("\n", '\n', $data_data) in there before doing
addslashes(). Believe it or not, thats the error.
Joao
--
Joćo Prado Maia <[EMAIL PROTECTED]>
http://phpbrasil.com - php com um jeitinho brasileiro
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]