Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    May 2003
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    The proper way to split code on multiple lines

    PHP Code:
    $query "INSERT INTO 2lssla (wfmcase, escdate, unitqty, company, priority, caselogger, description, status) VALUES ('{$_POST['wfmcase']}', '{date(m.d.y)}', '{$_POST['unitqty']}', '{$_POST['company']}', '{$_POST['priority']}', '{$_POST['caselogger']}', '{$_POST['description']}', '$_POST['status']}' )"
    How would you break this on to 2 or 3 lines for readability?

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    This is my preferred way of making it more readable:

    PHP Code:

    $query 
    "

        INSERT INTO 2lssla (
            wfmcase,
            escdate,
            unitqty,
            company,
            priority,
            caselogger,
            description,
            status
        )
        VALUES (
            '{$_POST['wfmcase']}',
            '{date(m.d.y)}', 
            '{$_POST['unitqty']}',
            '{$_POST['company']}',
            '{$_POST['priority']}',
            '{$_POST['caselogger']}',
            '{$_POST['description']}',
            '$_POST['status']}' 
        )
    "

    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •