[Lias] Re: [SLUG] PHP help

Simon Bryan sbryan at mpx.com.au
Thu Aug 16 13:35:11 UTC 2001


Thanks Mathew,
I have some experience with SQL but none with expressing it in terms that 
PHP understands, will take you suggestion and see where it leads me.

Cheers,

At 12:19 16/08/2001, Matthew Palmer wrote:
>On Thu, 16 Aug 2001, Simon Bryan wrote:
>
> > I am trying to modify a query in PHP that is running against a MYSQL
> > database. At the moment the query searches a field called 'contents' in 
> the
> > 'tracking' table. (see below) I would like to be able to search on the
> > 'computer' field in this table. Which I can do OK, however the field in
> > this table simply contains the ID number of the computer from the computer
> > table. The computer table, amongst other things contains the ID and a text
> > Description, it is this description that I would like the users to be able
> > to enter.
>
>Sounds to me like it's SQL help you need, rather than PHP.
>
>OK, to match the contents of one field against another, use a join.  You cna
>do it by having a member of your where clause with the form
>
>table1.column1=table2.column2
>
>and the tables are joined for that query.
>
>So, for this query, you might do:
>
>select description from computer where tracking.contents LIKE $contains and
>contents.id=computer.id
>
>This is the best guess I can make on the query from the info given.
>
>I'd suggest getting a good book on database design and SQL syntax.
>
>
>--
>-----------------------------------------------------------------------
>#include <disclaimer.h>
>Matthew Palmer
>mjp16 at ieee.uow.edu.au



Simon Bryan




More information about the lias mailing list