If I have a column with different values called vStatus (member-staus with value 100 – 200 – 300 etc.) in MySQL with diferent values, and I want to place those users in 3 columns in a table like this:
<tr>
<td><%=[user with value 200]%></td>
<td><%=[user with value 300]%></td>
<td><%=[user with value 400]%></td>
</tr>
it will work just fine. But if I loop through all users and place all users with the value 200 in the 1st column
<td><%=200%></td>
all users with the value 300 in the 2nd column
<td><%=300%></td>
and finally all users with the value 400 in the 3rd column
<td><%=400%></td>
it will look something like this:
<%
Set RScolumnA = Conn.Execute("SELECT username, firstname, middlename, lastname FROM users WHERE vStatus = 200 ORDER BY username ASC")
Set RScolumnB = Conn.Execute("SELECT username, firstname, middlename, lastname FROM users WHERE vStatus = 300 ORDER BY username ASC")
Set RScolumnC = Conn.Execute("SELECT username, firstname, middlename, lastname FROM users WHERE vStatus = 400 ORDER BY username ASC")
If Not RScolumnA.EOF OR RScolumnB.EOF OR RScolumnC.EOF Then
Do Until RScolumnA.EOF AND RScolumnB.EOF AND RScolumnC.EOF
%>
<tr>
<td><%=200%></td>
<td><%=300%></td>
<td><%=400%></td>
</tr>
<%
If Not RScolumnA.EOF Then
RScolumnA.MoveNext
End If
If Not RScolumnB.EOF Then
RScolumnB.MoveNext
End If
If Not RScolumnC.EOF Then
RScolumnC.MoveNext
End If
Loop
End If
%>
This works just fine, if there’s at least just one value in 1st AND in the 2nd column
But if I remove the only user with
vStatus = 200,
and there’s a user with
vStatus = 300
in the 2nd column, all of the
<tr>...</tr>
disapears.
If there’s at least a vStatus = 200 or vStatus = 300 – or more – no problem. But if there’s only 1 user with vStatus = 200, and only one user with vStatus = 300, and I remove one of them, everything disapears.
A friend of mine suggested using DB -> make an array -> place users in table with GetRows methods (res). But that doesn’t work.
I hope you understand my problem, and I hope to have some help. Thanks in advance
2
Answers
I added a getrows solution too if you needed that