PDA

View Full Version : Image Alignment dependant on Results


Brad
09-23-2002, 12:01 PM
Hi,

I want to display one of two icons, depending on the output of a table of results.

I'm using Count as a count of records. If this is 0, a smiley face appears, if other than 0, a skull and cross bones.

That bit is fine, and it works. However, here's the bit i'm stuck on:

I want the icon to appear at the top, before the table of results. So, basically, I have the problem of Count not yet being determined when I ask the page to display the icon, and therefore always get a smiley face.

Can anyone advise how I would get the page to calculate Count, then place the icon at the top, above the table, please ?

Thanks very much,

Brad.:(

raf
09-23-2002, 12:09 PM
I don't see the problem.

Do your count. store the result in a variable. Determine whitch image to display using an if-then-else routine on this variable. then start building and filling the table.

It might help if you include the code your using so we can modify it.

Brad
09-23-2002, 12:15 PM
If you could check this out it would be grand...

Hope it makes sense...

raf
09-23-2002, 12:26 PM
well,
i'd suggest you just check if the recordset is empty or not. If it's empty then yout tcount would be 0 in your loop.
so after your line
objrs.open SQLstr, objConn

insert followin code (i just pasted your code)

if objrs.EOF=true then
%>
<img src="../images/smiling.gif" width="48" height="48" border="0">

<%
else
%>
<img src="../images/skullnbonesw.gif" width="32" height="50" border="0">

<%end if%>


should do the trick

Brad
09-23-2002, 12:34 PM
That's grand, thanks very much indeed, did the trick a treat !

Brad.