Dreamwever and PHP for MYSQL

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
3dron
Forum Commoner
Posts: 40
Joined: Sat Feb 01, 2003 10:25 pm

Dreamwever and PHP for MYSQL

Post by 3dron »

I am wondering how do I include more than one table column in a search Query. In Dreamweaver it ask me to pic one column and returns any entries that match the search value.

Can I use a wildcard, something like "WHERE * =" in handcoding my PHP?

And is there a way to do it directly in Dreamweaver?

Thanks

RR
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

I don't really know what support DW has, but from a query point of view there are several ways to include from many tables in one query (I assume the data is related).. I like to explicit type out joins (as supposed to using FROM table1,table2 and strict with WHERE clauses), Myssql only supports inner/left joins.. maybe this sample gives you an idea, although a silly sample? columns with the same name from different tables must explicit be named table.column (and perhaps aliased if retrieved as associative array)

SELECT
company.name AS company,person.name,country.name AS department FROM person
LEFT JOIN company ON person.company_id = company.company_id
LEFT JOIN country ON company.country_id = country.country_id
WHERE person.name LIKE '%gates' AND company.name LIKE 'Micro%'
bionicdonkey
Forum Contributor
Posts: 132
Joined: Fri Jan 31, 2003 2:28 am
Location: Sydney, Australia
Contact:

Post by bionicdonkey »

u can use 'AND' in a WHERE. e.g. WHERE field1='$something' AND field2=$else
flyingchair
Forum Newbie
Posts: 3
Joined: Tue Feb 04, 2003 12:27 pm
Location: Hong Kong
Contact:

Post by flyingchair »

Dreamweaver MX has two ways of building a record set. When you add a record set in the bindings panel you get a pop up box. You will see either a button called "simple" or advanced" depending upon which mode you are in. You want advanced mode.

Don't bother with the buttons for select, where, etc.

You will have to type in the SQL code yourself. All normal SQL code will work including JOIN and USING. Once you have a JOIN statement in there you cannot return to simple mode to add filters, so type in the WHERE statement and the ORDER BY statement by hand in the SQL box. TEST does not work very well either once you get to joined tables. Click okay and your record set will be created.

I write the SQL code in MySQL Front first, if it gives me what I want I just cut and paste it into the advanced mode dialog box in dreamweaver and forget about it.

Hope that helps.
Post Reply