Page 1 of 1

Dreamwever and PHP for MYSQL

Posted: Sat Feb 01, 2003 10:25 pm
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

Posted: Sat Feb 01, 2003 11:20 pm
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%'

Posted: Sat Feb 01, 2003 11:22 pm
by bionicdonkey
u can use 'AND' in a WHERE. e.g. WHERE field1='$something' AND field2=$else

Posted: Tue Feb 04, 2003 12:36 pm
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.