[thelist] mysql primary key multiple columns

John Corry webshot at neoncowboy.com
Wed Aug 30 13:52:17 CDT 2000


>> p.s.  this business with the autonumbers is worth an article some day
>> but i keep putting it off...  can't get it into my head that people
>> might actually be interested...
>
>i certainly would be... as simple as it may seem, it took me a little
>while to grasp it in relation to everything else one tries to do to set
>up a db (like primary and foreign keys)...

I'm paying a lot more attention to these SQL related posts lately...writing
some simple (but increasingly complicated) 'applications' in PHP/MySQL.

An article by any of you on writing queries would be really cool...all of
the examples in the books/tutorials are real basic/ Like, SELECT * FROM
table WHERE name LIKE 'whatever'; works great for a tiny database, but what
happens when you drop * from 10,000 records into an array?

Another thing I'm struggling to wrap my head around is writing a search
function (geez, maybe I'm already off in assuming I have to write a function
for searching...), for instance:

I have a 13 column database table...

I can insert and select and print from the database with my PHP scripts...

The displaying data from depends on a query string in the URL (or, for the
variable $area having a valid value) <query>SELECT * FROM property WHERE
area = '$area'</query>.

What I want to do is to have a search form that lets me pass multiple values
(from a small form on the 'search' page) to a query like..
<query>SELECT * FROM property WHERE area = '$area' OR price = 'range
($lo_price, $hi_price)' OR bedrooms = '$br' </query>

See what I mean? Multiple variables make up the select. How does it work? I
haven't actually tried anything yet because I don't really know how to
approach the problem. I keep waiting for the link to the 'secret' PHP/MySQL
resource that actually shows examples of real code and how it works...the
resources I know of are good, but not entirely comprehensive at putting the
whole picture together...

thanks for any help..
John Corry
student of design
R35 Edu
http://www.r35.com/edu
'Higher learning for a better web'





More information about the thelist mailing list