Var problem ...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Web seller

    Var problem ...

    Hi,

    Can anyone explain me why this works?

    $buf =
    SendToHost('sho p.mcdos.nl','ge t','/control/productdetails? item_id=9219844 &search.x=11&se arch.y=6',
    $Cookie,'userna me=login&passwo rd=password&sub mit.x=24&submit .y=8n');

    While this doesn't ?

    $number=9219844 ;
    $buf =
    SendToHost('sho p.mcdos.nl','ge t','/control/productdetails? item_id=$number &search.x=11&se arch.y=6',
    $Cookie,'userna me=login&passwo rd=password&sub mit.x=24&submit .y=8n');

    Thanx.
  • Daniel Tryba

    #2
    Re: Var problem ...

    Web seller <webseller@priv acy.me.invalid> wrote:[color=blue]
    > $number=9219844 ;
    > $buf =
    > SendToHost('sho p.mcdos.nl','ge t','/control/productdetails? item_id=$number &search.x=11&se arch.y=6',[/color]

    RTFM: http://www.php.net/manual/en/language.types.string.php

    --

    Daniel Tryba

    Comment

    • Matthias Esken

      #3
      Re: Var problem ...

      Web seller wrote:
      [color=blue]
      > Can anyone explain me why this works?
      >
      > $buf =
      > SendToHost('sho p.mcdos.nl','ge t','/control/productdetails? item_id=9219844 &search.x=11&se arch.y=6',
      > $Cookie,'userna me=login&passwo rd=password&sub mit.x=24&submit .y=8n');
      >
      > While this doesn't ?
      >
      > $number=9219844 ;
      > $buf =
      > SendToHost('sho p.mcdos.nl','ge t','/control/productdetails? item_id=$number &search.x=11&se arch.y=6',
      > $Cookie,'userna me=login&passwo rd=password&sub mit.x=24&submit .y=8n');[/color]

      Yes. In the first peiece of code you transfer 9219844 as the value for
      the parameter item_id. In the second piece of code you transfer the
      string '$number' as the value. Please read the documentation and find
      the difference between single and double quotes.

      Regards,
      Matthias

      Comment

      Working...