Professional Web Applications Themes

Driving me nuts - PHP Development

tony kulik wrote: > Here's one that's driving me nut's > > This piece of code is included in another piece of code: > > <?php > if (!$modul=="") > { > include("inc/shop/".$modul.".php"); > } > else > { > include("inc/shop/section.php"); > } > ?> > > The first time it is called the var $modul is empty and the else > executes. The second time it is called var $modul contains the string > "prod" and the if executes. The third time it's called $modul contains > the string "cart" and I get an error "p error, unexpected T_IF ...

  1. #1

    Default Re: Driving me nuts

    tony kulik wrote:
    > Here's one that's driving me nut's
    >
    > This piece of code is included in another piece of code:
    >
    > <?php
    > if (!$modul=="")
    > {
    > include("inc/shop/".$modul.".php");
    > }
    > else
    > {
    > include("inc/shop/section.php");
    > }
    > ?>
    >
    > The first time it is called the var $modul is empty and the else
    > executes. The second time it is called var $modul contains the string
    > "prod" and the if executes. The third time it's called $modul contains
    > the string "cart" and I get an error "p error, unexpected T_IF in
    > shop.php line 4. The variables are definetly set as I went through
    > with a debugger. Anybody have any clue why it should execute once and
    > then throw an error the second time?
    >
    > Tony Kulik
    >
    >
    Just change if (!$modul == "") to if ($modul != "") ... operator
    precedence is probably causing some unexpected behavior there.

    Joshua Ghiloni Guest

  2. #2

    Default Re: Driving me nuts

    On Thu, 24 Jul 2003 02:41:17 GMT, [email]tkSPAMOFFackulik.com[/email] (tony kulik)
    wrote:
    >Here's one that's driving me nut's
    >
    >This piece of code is included in another piece of code:
    >
    ><?php
    >if (!$modul=="")
    >{
    > include("inc/shop/".$modul.".php");
    >}
    >else
    >{
    > include("inc/shop/section.php");
    >}
    >?>
    >
    >The first time it is called the var $modul is empty and the else
    >executes. The second time it is called var $modul contains the string
    >"prod" and the if executes. The third time it's called $modul contains
    >the string "cart" and I get an error "p error, unexpected T_IF in
    >shop.php line 4. The variables are definetly set as I went through
    >with a debugger. Anybody have any clue why it should execute once and
    >then throw an error the second time?
    >
    >Tony Kulik
    >
    >
    As it turns out it was a missing semicolon in the third module that
    was being loaded. The error kicked up when the module was loaded and
    compiled so the error showed up on the line that loaded it.
    Tony Kulik


    tony kulik Guest

Similar Threads

  1. Please help - this has been driving me nuts!
    By I R Godzilla webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 2
    Last Post: February 3rd, 11:27 PM
  2. preg_replace driving me nuts!
    By Greg Brondo in forum PHP Development
    Replies: 6
    Last Post: January 30th, 05:14 PM
  3. DateTime driving me nuts
    By Simple Simon in forum ASP.NET General
    Replies: 1
    Last Post: July 28th, 11:35 PM
  4. format driving me nuts
    By bob in forum ASP.NET General
    Replies: 0
    Last Post: July 15th, 01:41 AM
  5. xp_cmdshell driving me nuts! Experts please help!
    By Dr Deadpan in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 13th, 02:28 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139