Link to home
Start Free TrialLog in
Avatar of Melfeky
Melfeky

asked on

How can i order these elements on the page(a newbie question)

Hello all experts,
i have got a page that displays a piechart on it at the left of the page ,and another data that are driven from the db (code written in ASP).How can i put the data displayed in this page beside the piechart which is added as an include file.
I want all of them to be beside each other not under each other :
I want The piechart at the left and beside it the other data.
Here is the code of the page:
<!-- METADATA TYPE="typelib" FILE="D:\Program Files\Common Files\System\ado\msado15.dll" -->

<%@ Language = VBScript %>
<%Option Explicit%>
<!--#include file="pie-chart.asp"-->

<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<%
'coding by Lijun Guo of Astratel
dim  strDataPath, strConnectString, objConnection
'define valuables to store the total
dim t_calories, t_cholesterol, t_sodium, t_fatgrams,rs, sql_get, t_Saturated_Fat
dim dayofweek, d_date, int_days,int_rows, int_totals
dim foodtype, calories, fatgrams,cholesterol, counter, sodium ,Saturated_Fat
     int_days  = 0
     int_totals = 0
     int_rows = 0
     d_date = 0
     t_calories = 0
     t_cholesterol = 0
     t_sodium = 0
     t_fatgrams = 0
       t_Saturated_Fat = 0
     'set connection strings for entire application
     strDataPath = server.MapPath("DB1.mdb")
     strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;"_
              + " Data Source= " & strDataPath & ";"_
             + " Mode=Share Deny None;User Id=admin;PASSWORD=;"
     'strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;  Data Source=D:\astratel\test\Db1.mdb; Persist Security Info=False"
               
     if not IsObject("ojbConnection") then
         set objConnection=Server.CreateObject("ADODB.Connection")
         objConnection.ConnectionTimeout = 15
         objConnection.CommandTimeout =  10
          objConnection.Mode = 3 'adModeReadWrite
          if objConnection.state = 0 then
               objConnection.Open strConnectString
          end if
     end if


     'objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;  Data Source=D:\astratel\test\Db1.mdb; Persist Security Info=False"
    set rs = Server.CreateObject("ADODB.Recordset")
     sql_get = "select * from temp where MEMBER_ID = " & Session("MEMBER_ID") & " order by d_date"
     'rs.Open sql_get, objConnection
     rs.Open sql_get, objConnection, adOpenstatic, adLockOptimistic, adCmdText



%>


<table width="600" bordercolor="#000000">
  <tr>
    <td colspan="5" height="21">&nbsp;</td>
  </tr>
  <% while not rs.Eof
          foodtype = rs("Foodtype")
          calories = rs("Calories")
          fatgrams = rs("Fatgrams")
          cholesterol = rs("Cholesterol")
          fatgrams = rs("Sodium")
          cholesterol = rs("Saturated_Fat")
              d_date = Weekday(rs("d_date"))
          Select case d_date
          case 1
              dayofweek = "Sunday"
          case 2
              dayofweek = "Monday"
          case 3
              dayofweek = "Tuesday"
          case 4
              dayofweek = "Wednesday"
          case 5
              dayofweek = "Thursday"
          case 6
              dayofweek = "Friday"
          case 7
              dayofweek = "Saturday"
          End Select      

          if int_days  <> Weekday(rs("d_date")) then
               int_days = Weekday(rs("d_date"))
               int_totals = 0 'loop for different days only
               t_calories = 0
               t_cholesterol = 0
               t_fatgrams = 0
               t_Saturated_Fat = 0
               t_Sodium = 0
                    
                     int_rows = 0'show once only for each day
               'reset the variables for each day
  %>
  <tr>
    <td height="20" valign="top" colspan="3" > <b><font face='Arial' size=4 color=85A554>
      <% =Response.Write(dayofweek) & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" & rs("d_date") %>
      </font></b> </td>
    <td width="149"></td>
    <td width="294"></td>
  </tr>
  <tr>
    <td width="36"></td>
    <td></td>
    <td></td>
  </tr>
  <% End if %>
  <% While      int_rows < 9 and rs.eof = false
  if (int_days = Weekday(rs("d_date")))  then %>
  <tr>
    <td valign="top" height="18" colspan="2"><font face='Arial' size=2 color=85A554>
      Item selected: </font></td>
 
    <td colspan="3" valign="top"><font face='Arial' size=4 color=FF9900><%=Response.Write( "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;") & rs("Foodtype")  %> </font>
      <% 'loop the same day for different foodtypes and get the totals
if rs("Calories") <> "" then
     t_calories = t_calories + CInt(rs("Calories") )
End if
if rs("Fatgrams") <>"" then
     t_fatgrams = t_fatgrams + CInt(rs("Fatgrams"))
End if
if rs("Cholesterol") <> "" then
     t_cholesterol = t_cholesterol + CInt(rs("Cholesterol"))
End if
if rs("Sodium") <>"" then
     t_Sodium = t_Sodium + CInt(rs("Sodium"))
End if
if rs("Saturated_Fat") <> "" then
     t_Saturated_Fat = t_Saturated_Fat + CInt(rs("Saturated_Fat"))
End if
        %>
    </td>
    <td></td>
  </tr>
  <%
        int_rows = int_rows  + 1
      rs.MoveNext
      else
            int_rows = 9  'break the loop
      End if
      Wend
        if int_totals = 0 then
  %>
  <tr>
    <td colspan="5" height="21"> totalcholesterol : <%=t_cholesterol%> </td>
  </tr>
  <tr>
    <td colspan="5" height="21"> total fatgram: <%= t_fatgrams%> </td>
  </tr>
  <tr>
    <td colspan="5" height="21">Total calories : <%= t_calories%></td>
  </tr>
  <tr>
    <td colspan="5" height="21"> total sodium: <%= t_Sodium%> </td>
  </tr>
  <tr>
    <td colspan="5" height="21">Total Saturated_Fat : <%= t_Saturated_Fat%></td>
  </tr>
  <tr>
    <td colspan="5" height="21">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="5" height="21">&nbsp;</td>
  </tr>
  <tr>
    <td height="5"></td>
    <td width="50"></td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
  <%End if
  int_totals= int_totals + 1
  Wend %>
</table>
</BODY>
<%
     rs.close
     set rs = nothing
     objConnection.Close
     set objConnection = Nothing
%>

</HTML>
ASKER CERTIFIED SOLUTION
Avatar of sigmacon
sigmacon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of seanpowell
seanpowell
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Melfeky
Melfeky

ASKER

seanpowell:
Where shall i add this line:
<table width="600" bordercolor="#000000" style="float:right;">
Where you have this:

<table width="600" bordercolor="#000000">

change it to this:

<table width="600" bordercolor="#000000" style="float:right;">

Thanks,
Sean
Avatar of Melfeky

ASKER

Well thanks sean but still the same
melfeky, altthough I'd prefer Sean's css-based approach, have you tried my suggestion yet?
Avatar of Melfeky

ASKER

i have tried urs but everything is in a mess.
I don't know how to fix this .Have u any idea?
Avatar of Melfeky

ASKER

Would u check this link:

http://ccc.1asphost.com/kotty1234/Copy%20of%20Copy%20of%20crash/newlogin.ASP
username:user1
password:pass
 
click the "Journal "button u will be directed to the page that i am talking about .sorry for all this steps but this is how it works.
thanks,
What do you mean with 'everything is a mess'? You'll need to clarify this, so I can provide some input. Maybe you want to post the HTML that is the result after you included the chart? Than we could fix that and you can put the dynamic parts back in. It's hard to do HTML design on incomplete templates.
Avatar of Melfeky

ASKER

Here is the code after i have modified it.
<!-- METADATA TYPE="typelib" FILE="D:\Program Files\Common Files\System\ado\msado15.dll" -->

<%@ Language = VBScript %>
<%Option Explicit%>




<%
'coding by Lijun Guo of Astratel
dim  strDataPath, strConnectString, objConnection
'define valuables to store the total
dim t_calories, t_cholesterol, t_sodium, t_fatgrams,rs, sql_get, t_Saturated_Fat
dim dayofweek, d_date, int_days,int_rows, int_totals
dim foodtype, calories, fatgrams,cholesterol, counter, sodium ,Saturated_Fat
     int_days  = 0
     int_totals = 0
     int_rows = 0
     d_date = 0
     t_calories = 0
     t_cholesterol = 0
     t_sodium = 0
     t_fatgrams = 0
       t_Saturated_Fat = 0
     'set connection strings for entire application
     strDataPath = server.MapPath("DB1.mdb")
     strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;"_
              + " Data Source= " & strDataPath & ";"_
             + " Mode=Share Deny None;User Id=admin;PASSWORD=;"
     'strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;  Data Source=D:\astratel\test\Db1.mdb; Persist Security Info=False"
               
     if not IsObject("ojbConnection") then
         set objConnection=Server.CreateObject("ADODB.Connection")
         objConnection.ConnectionTimeout = 15
         objConnection.CommandTimeout =  10
          objConnection.Mode = 3 'adModeReadWrite
          if objConnection.state = 0 then
               objConnection.Open strConnectString
          end if
     end if


     'objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;  Data Source=D:\astratel\test\Db1.mdb; Persist Security Info=False"
    set rs = Server.CreateObject("ADODB.Recordset")
     sql_get = "select * from temp where MEMBER_ID = " & Session("MEMBER_ID") & " order by d_date"
     'rs.Open sql_get, objConnection
     rs.Open sql_get, objConnection, adOpenstatic, adLockOptimistic, adCmdText



%>

<table>
<BR>
<tr>
<BR>   
<td valign="top">

  <!--#include file="pie-chart.asp"-->
</td>
 <td valign="top">
 <BR>
  <% while not rs.Eof
          foodtype = rs("Foodtype")
          calories = rs("Calories")
          fatgrams = rs("Fatgrams")
          cholesterol = rs("Cholesterol")
          fatgrams = rs("Sodium")
          cholesterol = rs("Saturated_Fat")
              d_date = Weekday(rs("d_date"))
          Select case d_date
          case 1
              dayofweek = "Sunday"
          case 2
              dayofweek = "Monday"
          case 3
              dayofweek = "Tuesday"
          case 4
              dayofweek = "Wednesday"
          case 5
              dayofweek = "Thursday"
          case 6
              dayofweek = "Friday"
          case 7
              dayofweek = "Saturday"
          End Select      

          if int_days  <> Weekday(rs("d_date")) then
               int_days = Weekday(rs("d_date"))
               int_totals = 0 'loop for different days only
               t_calories = 0
               t_cholesterol = 0
               t_fatgrams = 0
               t_Saturated_Fat = 0
               t_Sodium = 0
                    
                     int_rows = 0'show once only for each day
               'reset the variables for each day
  %>
 
      <% =Response.Write(dayofweek) & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" & rs("d_date") %>
     
  <% End if %>
  <% While      int_rows < 9 and rs.eof = false
  if (int_days = Weekday(rs("d_date")))  then %>
 
 
    <font face='Arial' size=4 color=FF9900><%=Response.Write( "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;") & rs("Foodtype")  %> </font>
      <% 'loop the same day for different foodtypes and get the totals
if rs("Calories") <> "" then
     t_calories = t_calories + CInt(rs("Calories") )
End if
if rs("Fatgrams") <>"" then
     t_fatgrams = t_fatgrams + CInt(rs("Fatgrams"))
End if
if rs("Cholesterol") <> "" then
     t_cholesterol = t_cholesterol + CInt(rs("Cholesterol"))
End if
if rs("Sodium") <>"" then
     t_Sodium = t_Sodium + CInt(rs("Sodium"))
End if
if rs("Saturated_Fat") <> "" then
     t_Saturated_Fat = t_Saturated_Fat + CInt(rs("Saturated_Fat"))
End if
        %>
   
  <%
        int_rows = int_rows  + 1
      rs.MoveNext
      else
            int_rows = 9  'break the loop
      End if
      Wend
        if int_totals = 0 then
  %>
  <tr>
    <td colspan="5" height="21"> totalcholesterol : <%=t_cholesterol%> </td>
  </tr>
  <tr>
    <td colspan="5" height="21"> total fatgram: <%= t_fatgrams%> </td>
  </tr>
  <tr>
    <td colspan="5" height="21">Total calories : <%= t_calories%></td>
  </tr>
  <tr>
    <td colspan="5" height="21"> total sodium: <%= t_Sodium%> </td>
  </tr>
  <tr>
    <td colspan="5" height="21">Total Saturated_Fat : <%= t_Saturated_Fat%></td></tr><%End if
  int_totals= int_totals + 1
  Wend %><%
     rs.close
     set rs = nothing
     objConnection.Close
     set objConnection = Nothing
%>
</td><BR></tr><BR></table>
take out the line breaks between the table-related tags:

<table>
<tr>
<td valign="top">

</td></tr></table>

Also, I requested the RESULTING HTML as you deliver it to the browser. Do a 'view source' on the "mess" ;-)
Avatar of Melfeky

ASKER

Ok i removed the <br> and still a mess ,
i have removed all the html and left only
<table>
<tr>
<td valign="top">

</td></tr></table>
But still nothing.
here is the code  would u tell me how to arrange this?

<!-- METADATA TYPE="typelib" FILE="c:\Program Files\Common Files\System\ado\msado15.dll" -->

<%@ Language = VBScript %>
<%Option Explicit%>




<%
'coding by Lijun Guo of Astratel
dim  strDataPath, strConnectString, objConnection
'define valuables to store the total
dim t_calories, t_cholesterol, t_sodium, t_fatgrams,rs, sql_get, t_Saturated_Fat
dim dayofweek, d_date, int_days,int_rows, int_totals
dim foodtype, calories, fatgrams,cholesterol, counter, sodium ,Saturated_Fat
     int_days  = 0
     int_totals = 0
     int_rows = 0
     d_date = 0
     t_calories = 0
     t_cholesterol = 0
     t_sodium = 0
     t_fatgrams = 0
       t_Saturated_Fat = 0
     'set connection strings for entire application
     strDataPath = server.MapPath("DB1.mdb")
     strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;"_
              + " Data Source= " & strDataPath & ";"_
             + " Mode=Share Deny None;User Id=admin;PASSWORD=;"
     'strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;  Data Source=D:\astratel\test\Db1.mdb; Persist Security Info=False"
               
     if not IsObject("ojbConnection") then
         set objConnection=Server.CreateObject("ADODB.Connection")
         objConnection.ConnectionTimeout = 15
         objConnection.CommandTimeout =  10
          objConnection.Mode = 3 'adModeReadWrite
          if objConnection.state = 0 then
               objConnection.Open strConnectString
          end if
     end if


     'objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;  Data Source=D:\astratel\test\Db1.mdb; Persist Security Info=False"
    set rs = Server.CreateObject("ADODB.Recordset")
     sql_get = "select * from temp where MEMBER_ID = " & Session("MEMBER_ID") & " order by d_date"
     'rs.Open sql_get, objConnection
     rs.Open sql_get, objConnection, adOpenstatic, adLockOptimistic, adCmdText



%>

<table>



<td >

  <!--#include file="pie-chart.asp"-->
</td>
 <td valign="top">
 
  <% while not rs.Eof
          foodtype = rs("Foodtype")
          calories = rs("Calories")
          fatgrams = rs("Fatgrams")
          cholesterol = rs("Cholesterol")
          fatgrams = rs("Sodium")
          cholesterol = rs("Saturated_Fat")
              d_date = Weekday(rs("d_date"))
          Select case d_date
          case 1
              dayofweek = "Sunday"
          case 2
              dayofweek = "Monday"
          case 3
              dayofweek = "Tuesday"
          case 4
              dayofweek = "Wednesday"
          case 5
              dayofweek = "Thursday"
          case 6
              dayofweek = "Friday"
          case 7
              dayofweek = "Saturday"
          End Select      

          if int_days  <> Weekday(rs("d_date")) then
               int_days = Weekday(rs("d_date"))
               int_totals = 0 'loop for different days only
               t_calories = 0
               t_cholesterol = 0
               t_fatgrams = 0
               t_Saturated_Fat = 0
               t_Sodium = 0
                    
                     int_rows = 0'show once only for each day
               'reset the variables for each day
  %>
 
      <% =Response.Write(dayofweek) & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" & rs("d_date") %>
     
  <% End if %>
  <% While      int_rows < 9 and rs.eof = false
  if (int_days = Weekday(rs("d_date")))  then %>
  <TR>
  <TD>
    <b><font face='Arial' size=2 color=FF9900><%=Response.Write( "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;") & rs("Foodtype")  %> </font></b>
      <% 'loop the same day for different foodtypes and get the totals
if rs("Calories") <> "" then
     t_calories = t_calories + CInt(rs("Calories") )
End if
if rs("Fatgrams") <>"" then
     t_fatgrams = t_fatgrams + CInt(rs("Fatgrams"))
End if
if rs("Cholesterol") <> "" then
     t_cholesterol = t_cholesterol + CInt(rs("Cholesterol"))
End if
if rs("Sodium") <>"" then
     t_Sodium = t_Sodium + CInt(rs("Sodium"))
End if
if rs("Saturated_Fat") <> "" then
     t_Saturated_Fat = t_Saturated_Fat + CInt(rs("Saturated_Fat"))
End if
        %>
   
  <%
        int_rows = int_rows  + 1
      rs.MoveNext
      else
            int_rows = 9  'break the loop
      End if
      Wend
        if int_totals = 0 then
  %>
 
 
    Total Cholesterol : <%=t_cholesterol%>
 
 
   total fatgram: <%= t_fatgrams%>
 
 
    Total calories : <%= t_calories%>
 
   
     total sodium: <%= t_Sodium%>
 

   Total Saturated_Fat : <%= t_Saturated_Fat%><%End if
  int_totals= int_totals + 1
  Wend %><%
     rs.close
     set rs = nothing
     objConnection.Close
     set objConnection = Nothing
%>
</td></table>
Now you also removed the <tr>s! You need to keep them. Just remove the <br>s and put the <tr>s back in!

Unless you post the HTML code of generated page as it shows in your browser, I cannot help you any further. Sorry.
Avatar of Melfeky

ASKER

well i did added the <tr>s but still the same .
Any way thanks for trying to help.
Hi Melfeky, I'm afraid you code has a number of errors regarding basic html syntax.
Until we can start off with a well formed document, there's not much we can do for you.

I need to be blunt here - do you have access to anyone with some basic html formatting knoweldge, it would help us be able to help you if we could get the code up to par.

Thanks,
Sean