Hi
I am getting "Cannot use a scalar value as an array"

In the following code:

for ($i=1; $i<=$session[norows]; $i++) {
$r[$i]["sid"] = ${"rsid".$i}; // error on this line
}

This is code that has worked for over a year running php 4.0.6 on a shared host (webfusion)

The servers have recently been upgraded to php 4.1.2 by webfusion

Any Ideas?
Chris

    from what I know of this:

    ${"rsid".$i};

    thats makeing a variable called $rsid1, $rsid2 etc. Do these have values?

    And why has it taken this long for webfusion to upgrade to 4.1.2 and why didn't they upgrade to 4.3.1 ?

      Hi Marque

      No its actually on the first pass ... so ...
      $session[norows] = 1
      ${"rsid".$i} = $rsid1
      $rsid1=""

      This has never been a problem in the past ... in fact I init back to these values when setting up a new record.

      This is probably just a config problem ... or maybe now I have to predefine the array ... I just wondered if anyone had hit a similar prob during a recent upgrade.

      I have been with webfusion for several years now and only had one other server update. ... I dont mind this too much as you dont get caught out by upgrades / configuration changes killing your customers code.

      They started upgrading their servers in September last year and only just finished ... I think they have moved them all to the same version as the first ones, for ease of support.

      Chris

        Yeah, probably is a configuration problem, no idea what though.

        Up untill now I have never seen that problem before, but from what i can gather, it means it cant assign a value of an array to something that doens't have a value or magnitude.

        I could be wrong, quite likely actually. I had to look up the definition of scalar in the dictionary.

        If you can run phpinfo() on your server i sugest cross referencing from another server's phpinfo(), looking at the Configure Command.

          Thank Marque

          I have been trying to duplicate the error in a test prog but cant yet !?!

          A simple Google search on the error returns loads of sites with the error but little info on it...

          Unfortunatly Webfusion have disabled phpinfo() 'for security reasons'

          Thanks anyway .... when I find out the reason I will post a resolution.

          Later ...

          Chris

            Write a Reply...