[thelist] PHP & MySQL - Generating dynamic pages...

Erik Bennett ebennett at ecasd.k12.wi.us
Fri Jul 26 13:20:01 CDT 2002

Hi guys... Just joined the list 2 days ago and have been __flooded__ with
useful information. Wow. So I knew this was the place to come and ask my

I'm a relative newbie to PHP & MySQL. What I'm trying to do is replicate
something I've been doing with ASP and Access for quite a while, and I've
hit the wall, and have a problem that I just can't wrap my brain around.

I want to pass a variable (in this case, State=California) from one page to
another in this way, display.php?State=California. When display.php gets
this query string, it's supposed to go into the database and pull out all of
the entries that have California as a State and display them in a table. The
State field is field 3 (actually field 4, but it's field 3 when starting
with 0). Still with me?

Sounds relatively simple. I've got the SELECT * FROM db WHERE State=$State,
blah blah blah...

(Sorry I don't have the actual code to post, if anybody really wants to see
it, I can post it)

Now here's the interesting part. I've got it set up to return "No seminars
were found" if nothing is found, and when I pass it State=California it
returns that. Even though there are entries in the database with California
in the State field.

Now here's where it gets interesting. When I pass SemID to the script, i.e.
display.php?SemID=8 (and change the SQL statement to SELECT * FROM db WHERE
SemID=$SemID) it does __exactly__ what I want it to. Am I missing something
with MySQL and PHP about placement of fields? I've checked & rechecked my
variable names and such, and they're all right. Am I missing anything?

Thanks in advance for any help you can give, or if anyone can point me to a
tutorial that explains how to do what I'm trying to do...


Erik Bennett
ECASD Webmaster			Network Accounts
ebennett at ecasd.k12.wi.us 		accounts at ecasd.k12.wi.us
http://www.ecasd.k12.wi.us		http://www.ecasd.k12.wi.us/webmaster/accounts

500 Main Street
Eau Claire, WI 54701
Phone:	715-839-6290 x551
Fax:	715-833-3481

More information about the thelist mailing list