Hello everyone,
My query looks like this
<%
SQLQuery2 = "SELECT Gift.Name AS Name, Gift.Description AS Description, Gift.QuantityDesired AS QuantityDesired, SUM(GiftGuest.QuantityGiven) AS QuantityGiven FROM Gift LEFT JOIN GiftGuest ON Gift.GiftID = GiftGuest.GiftID GROUP BY Gift.GiftID"
Set RSGiftList = OBJdbConnection.Execute(SQLQuery2)
%>
I'd like to display the information in the recordset the same way it's displayed when I run this query in php admin -- except that rather than display "null" if QuantityGiven is null, I'd like to display "none".
What happens, though, is that if I loop through the recordset and display all the information in the recordset _except_ QuantityGiven, everything is fine. As soon as I put <%= RSGiftList("QuantityGiven") %> anywhere in the page, though, I just get an error message in the browser. I've tried
<% IF RSGiftList("QuantityGiven") IS NULL or RSGiftList("QuantityGiven") = "" or RSGiftList("QuantityGiven")= null THEN %>
none
<%ELSE %>
<%= RSGiftList("QuantityGiven") %>
<%END IF%>
With this code I still get the error in the browser.
What am I doing wrong? Is there a better way to structure the query?
Thank you for your help
Hi,
Note sure why you get the first error, but the second...
Aren't you trying to put a string into an integer? Null can be used for any variable, but if your QuantityGiven is an integer then trying to put 'None' into it won't work.
Just a thought.
Dave