GarryJones wrote:
> This works fine
>
> $ml_collect='SELECT * FROM ml_lopp LEFT JOIN scfmforening ON
> (scfmforening.scfmnum=ml_lopp.scfmnum) LEFT JOIN ml_newtidplats ON
> (ml_newtidplats.loppnum=ml_lopp.loppnum) ORDER BY date1,
> ml_lopp.loppnum';
>
> And I can process and get the records starting with this...
>
> $ml_upg=mysql_query($ml_collect);
>
> Now I need to add this Where statement in the code.
>
> WHERE sank2006 = 'Ansökt' -
>
> (I know I need to escape the quotes with backslash, but Its misfiring
> and not picking up records)
>
> I am trying this
>
> $ml_collect='SELECT * FROM ml_lopp WHERE sank2006 = \'Ansökt\' LEFT
> JOIN scfmforening ON (scfmforening.scfmnum=ml_lopp.scfmnum) LEFT JOIN
> ml_newtidplats ON (ml_newtidplats.loppnum=ml_lopp.loppnum) ORDER BY
> date1, ml_lopp.loppnum';
>
> Where am I going wrong?
>
> Grateful for any help in this matter
>
> Garry Jones
> Sweden
>
$ml_collect = "SELECT * FROM ml_lopp LEFT JOIN scfmforening ON ";
$ml_collect .= "(scfmforening.scfmnum=ml_lopp.scfmnum) LEFT JOIN ";
$ml_collect .= "ml_newtidplats ON (ml_newtidplats.loppnum=ml_lopp.loppnum) ";
$ml_collect .= "WHERE ml_lopp.sank2006 = \'Ansökt\' ";
$ml_collect .= "ORDER BY ml_lopp.date1, ml_lopp.loppnum";
Note the position of the WHERE clause.
--
Michael Austin
Database Consultant
Domain Registration and Linux/Windows Web Hosting Reseller
http://www.spacelots.com