PDA

View Full Version : simple syntax error I can't figure out


gcapp
09-04-2002, 03:25 PM
If someone could help me with this simple syntax problem I would appreciate it.

I have this syntax problem with this line of code:
<td width="339"><%=rstext("City") & "," & ("State") & ("Zip")%></td>

The code works but it doesn't give me the results I want.

It gives me the correct city from my database, but it then shows "State" and "Zip" instead of the actual state and zip.

Example: The code gives me - Baltimore,StateZip. Obviously this is wrong. I would want it to be - Baltimore, Maryland 16556

Can someone give me the correct code??

Thanks,
Gary

Brad
09-04-2002, 04:30 PM
Try:

<%=rstext("City") & "," & "'State'" & "'Zip'"%></td>

Where there are single quotes inside double quotes

If it's from a database, try defining variables first, so:

dbstate = rstext("state")

(assuming rstext is the name of your record set) so the string would read

& "'dbstate'" &


You could also try making the state and zip match the city, so:

= rstext("City") & ", " & =rstext("State") ...

Brad.

whammy
09-04-2002, 05:57 PM
You simply forgot to put the recordset var in front of State and Zip:

<td width="339"><%=rstext("City") & ", " & rstext("State") & " " & rstext("Zip")%></td>

I also added a couple spaces in there so it looks better.

Roy Sinclair
09-04-2002, 05:59 PM
You have:

<%=rstext("City") & "," & "'State'" & "'Zip'"%>

You need:

<%=rstext("City")%>,<%=rstext("State")%><%=rstext("Zip")%>

or:

<%=rstext("City") & "," & rstext("State") & rstext("Zip")%>

or

<% document.write (rstext("City"),",",rstext("state"),rstext("Zip"))%>

gcapp
09-04-2002, 06:33 PM
Roy,
Thanks for your reply - I just posted another stupid syntax error I get with some code that maybe you can help me with.

gary