Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-10-23
15
Medium Priority
?
145 Views
Last Modified: 2010-04-09
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>
0
Comment
Question by:Melfeky
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 3
15 Comments
 
LVL 8

Accepted Solution

by:
sigmacon earned 1000 total points
ID: 12391754
wrap another table around it:

<table>
<tr>
    <td valign="top">
        <!-- your chart include goes here --->
    </td>
    <td valign="top">
        <!-- the two tables in your code above, which I am assuming is your data, go here --->
    </td>
</tr>
</table>
0
 
LVL 31

Assisted Solution

by:seanpowell
seanpowell earned 1000 total points
ID: 12393087
Just float your data table:

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

Sean
0
 

Author Comment

by:Melfeky
ID: 12393297
seanpowell:
Where shall i add this line:
<table width="600" bordercolor="#000000" style="float:right;">
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 31

Expert Comment

by:seanpowell
ID: 12393304
Where you have this:

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

change it to this:

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

Thanks,
Sean
0
 

Author Comment

by:Melfeky
ID: 12394387
Well thanks sean but still the same
0
 
LVL 8

Expert Comment

by:sigmacon
ID: 12394480
melfeky, altthough I'd prefer Sean's css-based approach, have you tried my suggestion yet?
0
 

Author Comment

by:Melfeky
ID: 12394555
i have tried urs but everything is in a mess.
I don't know how to fix this .Have u any idea?
0
 

Author Comment

by:Melfeky
ID: 12394611
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,
0
 
LVL 8

Expert Comment

by:sigmacon
ID: 12394615
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.
0
 

Author Comment

by:Melfeky
ID: 12394616
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>
0
 
LVL 8

Expert Comment

by:sigmacon
ID: 12394640
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" ;-)
0
 

Author Comment

by:Melfeky
ID: 12394937
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>
0
 
LVL 8

Expert Comment

by:sigmacon
ID: 12395122
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.
0
 

Author Comment

by:Melfeky
ID: 12395266
well i did added the <tr>s but still the same .
Any way thanks for trying to help.
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 12395788
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



0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question