Results 1 to 8 of 8

Thread: Blank Cells

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    46

    Angry

    I have an html table that is being generated from data in a table (database table). I have connected to the database. However if a cell is empty in my database the cell for that table is not being drawn. It is like it leaves a hole in the page until the next record with data in it is populated. Can this be fixed. If I need to attach code I will.

    Thanks.

  2. #2
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    post your code
    it will be easier if we see your code!!

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    46
    Here is my code.

    Thanks.

    <%
    Dim rsATL
    set rsATL= server.createobject("ADODB.recordset")

    rsATL.open "select * from extension where office='Atlanta'", "DSN=directory"

    rsATL.MoveFirst

    response.write "<div align='center'><font color=#2B4595><h1>Atlanta Directory</h1></font></div>"
    response.write "<div align='center'>"
    response.write "<Table border='1' width='550'><TR height=40>"
    Response.Write "<TH><font color=#2B4595><u>Last Name</u></font></TH>"
    Response.Write "<TH><font color=#2B4595><u>First Name</u></font></TH>"
    Response.Write "<TH><font color=#2B4595><u>Extension</u></font></TH>"
    Response.Write "<TH><font color=#2B4595><u>Mobile</u></font></TH>"
    Response.Write "<TH><font color=#2B4595><u>Notes</TD></u></font></TH>"


    do while not rsATL.eof
    response.write "<TR><TD height=25>" & rsATL("Last_Name") & "</TD>"
    response.write "<TD height=25>" & rsATL("First_Name") & "</TD>"
    response.write "<TD height=25 align='center'>" & rsATL("Extension") & "</TD>"
    response.write "<TD height=25 align='center'>" & rsATL("Mobile") & "</TD>"
    response.write "<TD height=25>" & rsATL("Notes") & "</TD> </TR>"
    rsATL.movenext
    loop
    response.write "</table>"
    rsATL=close
    set rsATL = nothing
    %>

  4. #4
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    you can do something like:
    if rsATL("Last_Name") <> "" then
    response.write "<TR><TD height=25>" & rsATL("Last_Name") & "</TD>"
    else
    response.write "<TR><TD height=25></TD>"
    end if


    ...is that what you need??

  5. #5

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    46
    Nope. Did not work. Thanks anyway. I need to tell it coming into the page, that the field is null. I think?!?!?


  6. #6

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    46
    I tweaked with it long enough and the followig works!! It was not as hard as it appears. I sorta feel foolish that I did not think of it sooner!!!

    Thanks again for your help.



    if not isnull(rsATL.Fields("Mobile")) then
    response.write "<TD height=25 align='center'>" & rsATL("Mobile") & "</TD>"
    else
    response.write "<TD height=25 bordercolor='#C0C0C0'>&nbsp;</TD>"
    end if

    [Edited by moose on 01-17-2001 at 05:09 PM]

  7. #7
    Guest
    I'm a bit surprised what you did works but well done. For properly formed HTML I'd use a non breaking space.

    emptycell = "<td>&nbsp;</td>"

  8. #8

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    46
    That's what I did I just forgot my non breaking space. I have added it to my code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width