NYCPHP Meetup

NYPHP.org

[nycphp-talk] mysql question

Hans Zaunere zaunere at yahoo.com
Wed Jun 4 12:32:02 EDT 2003


--- "John W. Markert" <markert at optonline.net> wrote:
> Please advise, is the following possible in mysql or is one limited to
> joining 2 tables.
> 
>      $query = "select * from advlistings, valsec, valprim
>       where ((advlistings.advId=$advId)
>       and (valsec.SecID=advlistings.secId)    
>       and (valprim.primeId=valsec.primeID))";
> 
> assume all table names are corect and .variables are correct.

Hmm, looks ok.  Just rewriting so I see things clearer:

$query = "SELECT *
            FROM advlistings, valsec, valprim
           WHERE advlistings.advId=$advId
             AND valsec.SecID=advlistings.secId
             AND valprim.primeId=valsec.primeID";

> the error that I get is:
>     Unknown column 'valprim.primeId' in 'where clause'

Do you have multiple MySQL links open?  Perhaps case-sensitivity is an issue?
 It's always a good idea to specify the MySQL link resource in mysql_query()
IMO.  

H




More information about the talk mailing list