[Mapserver-users] queryByAttributes on TWO OR MORE fields

Daniele Margotti margottid at comune.lugo.ra.it
Thu Jul 8 04:58:49 EDT 2004


This is a multi-part message in MIME format.


------=_NextPart_000_001C_01C464DA.8C84D460
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

I have a shapefile and I want to query two fields:
 - 'street'  (the name of the street)
 - 'civic' (the civic number of the address)
 
For example, in SQL I'd have: SELECT * FROM table WHERE street='Main
Street' AND civic=15;
 
How can I do it with PHP/MapScript?
 
I tried:
    ...
    $StreetName = 'Main Street';
    $CivicNumber = 15;
    if
((@$Layer->queryByAttributes('street'&'civic',$StreetName.$CivicNumber,M
S_SINGLE) {
    ...
but this obviously returns an error.
 
Can you help me?
 
Thank you,
    Daniele
 
 


------=_NextPart_000_001C_01C464DA.8C84D460
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Messaggio</TITLE>

<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial size=3D2>I have =
a shapefile=20
and I want to query two fields:</FONT></SPAN></DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial =
size=3D2>&nbsp;-=20
'street'&nbsp; (the name of the street)</FONT></SPAN></DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial =
size=3D2>&nbsp;- 'civic' (the=20
civic number of the address)</FONT></SPAN></DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial size=3D2>For =
example, in SQL=20
I'd have: SELECT *&nbsp;FROM table WHERE street=3D'Main Street' AND=20
civic=3D15;</FONT></SPAN></DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial size=3D2>How =
can I do it with=20
PHP/MapScript?</FONT></SPAN></DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial size=3D2>I=20
tried:</FONT></SPAN></DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;=20
...</FONT></SPAN></DIV>
<DIV><SPAN class=3D010585008-08072004>&nbsp;&nbsp;&nbsp; <FONT =
face=3DArial=20
size=3D2>$StreetName =3D 'Main Street';</FONT></SPAN></DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;=20
$CivicNumber =3D 15;</FONT></SPAN></DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;=20
if=20
((@$Layer-&gt;queryByAttributes('street'&amp;'civic',$StreetName.$CivicNu=
mber,MS_SINGLE)=20
{</FONT></SPAN></DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;=20
...</FONT></SPAN></DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial size=3D2>but =
this obviously=20
returns an&nbsp;error.</FONT></SPAN></DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial size=3D2>Can =
you help=20
me?</FONT></SPAN></DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial size=3D2>Thank=20
you,</FONT></SPAN></DIV>
<DIV><SPAN class=3D010585008-08072004>&nbsp;&nbsp;&nbsp; <FONT =
face=3DArial=20
size=3D2>Daniele</FONT></SPAN></DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D010585008-08072004><FONT face=3DArial =
size=3D2>&nbsp;</DIV>
<DIV><BR></DIV></FONT></SPAN></BODY></HTML>

------=_NextPart_000_001C_01C464DA.8C84D460--




More information about the mapserver-users mailing list