php MySQL works on remote server, only partially on local server

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

    #1

    php MySQL works on remote server, only partially on local server

    I am new at php and MySQL and have some (ugly, I'm sure) code to
    populate form select fields with data from a MySQL database, so a user
    can use those to sort/filter and view the 3,000 records. No inserts --
    just selects; very simple.

    I originally set this up using URL-based query strings at
    http://stjuliana.org/school/ar/BUindex.php but since that only allowed
    sorting and not filtering, hence all 3k records load, I made a form
    verson at http://stjuliana.org/school/ar/index.php . Everything works
    just fine, however, there's still a lot of tweaking I want to do, such
    as splitting the form input and output into two pages (_blank), having
    a printable version, etc. To that end I just set up the latest builds
    of Apache, php and MySQL on my local Windows XP box, lest I blow my
    beer budget for the month on bandwidth overage. <g>

    I have a very simple page I used to test my localhost setup and
    everything's fine. I can connect to MySQL, create, insert and select
    from DBs, so I know my config is fine. All my other .php pages on this
    site work fine locally as well.

    The two abovementioned pages, however, are giving me fits when run
    locally...

    For the URL-query-string version, it loads up with the default view
    (=name_ns), which grabs all records and sorts by name and point asc.
    No matter which of the other sort 'views' I might choose, it still
    loads up all the records in that default sort. The server's holding on
    to something and I don't know how to clear it. The remote version
    correctly sorts based on the query string chosen.

    The form version is worse. It connects to the DB and populates the
    select boxes with the field data -- that part's fine. But no matter
    which submit button is selected, no data is retrieved. I get no error,
    but no data either. The form's action is set to $_SERVER['PHP_SELF']
    and I've tried both GET and POST -- no change.

    Since the exact same pages work on the remote server I know it has to
    be something on the local setup. But where do I look if there's no
    obvious error?

    This is probably something incredibly basic but I'm bleary-eyed from
    reading tutorials and forums all over the Internet and can't come up
    with anything.

    TIA
    Hera


  • Geoff Berrow

    #2
    Re: php MySQL works on remote server, only partially on local server

    I noticed that Message-ID: <jtkoo0tq2g0bms 72kpeg0ib3r7ud5 g725s@4ax.com>
    from hera contained the following:
    [color=blue]
    >Since the exact same pages work on the remote server I know it has to
    >be something on the local setup. But where do I look if there's no
    >obvious error?[/color]

    This is most likely a register globals issue. If you are passing the
    sort criteria to the script via a form you need to make sure you
    retrieve them via the $_POST array

    Try echoing your SQL to the screen to see what you are actually
    searching for.

    --
    Geoff Berrow (put thecat out to email)
    It's only Usenet, no one dies.
    My opinions, not the committee's, mine.
    Simple RFDs http://www.ckdog.co.uk/rfdmaker/

    Comment

    • hera

      #3
      Re: php MySQL works on remote server, only partially on local server

      Thank you so much - that was indeed the answer and now I can test to
      my heart's content locally.

      The comments in php.ini indicate that turning register_global s on is a
      security risk and my host obviously has this setting on or the script
      wouldn't have worked remotely. Ergo, I've not done a good job with my
      script in that I should get it to work with register_global s off, so
      it's more secure.

      Thanks again,
      Hera


      On Sat, 06 Nov 2004 08:25:04 +0000, Geoff Berrow
      <blthecat@ckdog .co.uk> wrote:
      [color=blue]
      >This is most likely a register globals issue.[/color]

      Comment

      Working...