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

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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 but since that only allowed
sorting and not filtering, hence all 3k records load, I made a form
verson at . 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

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.


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

from hera contained the following:

Quoted text here. Click to load it

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 /

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_globals 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_globals off, so
it's more secure.

Thanks again,

On Sat, 06 Nov 2004 08:25:04 +0000, Geoff Berrow

Quoted text here. Click to load it

Site Timeline