fast question: sql bad syntax

i got an error here..
i want to set in variable a name of column...and that depends on what being posted to view the data...

i got syntax error...

heeelp:)
<%
dim FW
FW = request.querystring("act")
IF FW="1" THEN
imgsrc="fromloc.gif"
sfield="uname"
END IF
%>
 
  <img alt="" src="<%=imgsrc%>"/>
<br/>  
<%
dim xd, mySQL, conntemp, rstemp
mysql="SELECT " & sfield & ",id from demo_users where left(" & sfield & ",2)='Ãâ¬S' order by " & sfield & ""

Open in new window

sasha85Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
when FW is not equal to "1", what should sfield be, instead?
you have to put a default value...

<%
sfield="uname" 
dim FW
FW = request.querystring("act")
IF FW="1" THEN
imgsrc="fromloc.gif"
sfield="uname"
END IF
%>
 
  <img alt="" src="<%=imgsrc%>"/>
<br/>  
<%
dim xd, mySQL, conntemp, rstemp
mysql="SELECT " & sfield & ",id from demo_users where left(" & sfield & ",2)='???S' order by " & sfield & ""

Open in new window

0
 
Malik1947Commented:
try it this way.

mysql="SELECT " & sfield & ",id from demo_users where " & left(sfield,2) & "='Ãâ¬S' order by " & sfield & ""

Open in new window

0
All Courses

From novice to tech pro — start learning today.