jonjon1123
06-02-2008, 08:45 AM
I am having problems with Dreamweaver's line breaks and javascript. I have a string I define in PHP:
$query = "SELECT DISTINCT Book.Title, Book.BookID
FROM Book, BookItem, Library, Teacher, Classroom, School
WHERE Teacher.ClassroomID = Classroom.ClassroomID
AND Classroom.SchoolID = School.SchoolID
AND Library.LibraryID = Teacher.LibraryID
AND Library.LibraryID = BookItem.LibraryID
AND Book.BookID = BookItem.BookID
AND Teacher.Status = 'active'
AND Teacher.TeacherID = '$teacherID'
AND DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= dateAdded
ORDER BY dateAdded DESC
LIMIT 0, 5";
The code is formatted in Dreamweaver just like you are seeing it. Line breaks before the FROM and before the WHERE and before the ANDs...etc. When I try and use this string in Javascript:
echo "<script type=\"text/javascript\" language=\"javascript\">parent.location.href='databaseError.php?ErrorType=QUERY EXECUTION ERROR&ErrorText=" . addslashes(mysql_error()) . "&ErrorPage=" . addslashes($_SERVER["REQUEST_URI"]) . "&Query=" . addslashes($query) . "';</script>"
The web developer toolbar for Firefox throws an error on the first line break (i.e. the FROM line in the first block of code I showed you). Is there something wrong with the Dreamweaver line breaks? Are they not compatible with PHP or Javascript line breaks? If I take out the formatting line breaks in Dreamweaver there are no errors so why can't I format my code in Dreamweaver?
$query = "SELECT DISTINCT Book.Title, Book.BookID
FROM Book, BookItem, Library, Teacher, Classroom, School
WHERE Teacher.ClassroomID = Classroom.ClassroomID
AND Classroom.SchoolID = School.SchoolID
AND Library.LibraryID = Teacher.LibraryID
AND Library.LibraryID = BookItem.LibraryID
AND Book.BookID = BookItem.BookID
AND Teacher.Status = 'active'
AND Teacher.TeacherID = '$teacherID'
AND DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= dateAdded
ORDER BY dateAdded DESC
LIMIT 0, 5";
The code is formatted in Dreamweaver just like you are seeing it. Line breaks before the FROM and before the WHERE and before the ANDs...etc. When I try and use this string in Javascript:
echo "<script type=\"text/javascript\" language=\"javascript\">parent.location.href='databaseError.php?ErrorType=QUERY EXECUTION ERROR&ErrorText=" . addslashes(mysql_error()) . "&ErrorPage=" . addslashes($_SERVER["REQUEST_URI"]) . "&Query=" . addslashes($query) . "';</script>"
The web developer toolbar for Firefox throws an error on the first line break (i.e. the FROM line in the first block of code I showed you). Is there something wrong with the Dreamweaver line breaks? Are they not compatible with PHP or Javascript line breaks? If I take out the formatting line breaks in Dreamweaver there are no errors so why can't I format my code in Dreamweaver?