www.webdeveloper.com
Results 1 to 5 of 5

Thread: i dont get data results

  1. #1
    Join Date
    Apr 2011
    Posts
    24

    i dont get data results

    Hello i use a javascript in order to display data from my data page.
    At the moment the table is displayed but with no values need some help probably.
    Alo it would be great if there is a way using an if else statement to run a 2nd or a 3rd queri dipending on user inputs


    My main page (probably is right since i get table but with no values):

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    
    <script type="text/javascript">
    function showUser()
    {
    	if (window.XMLHttpRequest)
    	{// code for IE7+, Firefox, Chrome, Opera, Safari
    		xmlhttp=new XMLHttpRequest();
    	} else {// code for IE6, IE5
    		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    	}
    	var t=document.getElementById("type");
    	var t_val = t.options[t.selectedIndex].value;
    	var c_val = document.getElementById("checkin").value;
    	var r_val = document.getElementById("checkout").value;
    
    	 xmlhttp.onreadystatechange=function()
    	{
    		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    		{
    			document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    		}
    	}
    	 xmlhttp.open("GET","check11.asp?q=" + t_val + "&c=" + c_val+"&r=" +r_val, true);
    	 xmlhttp.send();
    }
    </script>
    
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <form action="">
    	<select id="type" onchange="showUser();">
    		<option value="">types</option>
    		<option value="single">single</option>
    		<option value="double">double</option>
    		<option value="suite">suits</option>
    	</select>
    	<input id="checkin"  onchange="showUser();" size="22"/>
    	<input id="checkout"  onchange="showUser();" size="22"/>
    </form>
    <br />
    <div id="txtHint">here...</div>
    </body>
    </html>
    my data page (need some help here i think):


    Code:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    <!--#include file="Connections/sqlconn.asp" -->
    <%
    Dim sql__MMColParam
    sql__MMColParam = "1"
    If (Request.Form("type") <> "") Then 
      sql__MMColParam = Request.Form("type")
    End If
    %>
    <%
    Dim sql
    Dim sql_cmd
    Dim sql_numRows
    
    Set sql_cmd = Server.CreateObject ("ADODB.Command")
    sql_cmd.ActiveConnection = MM_sqlconn_STRING
    sql_cmd.CommandText = "SELECT dbo.rooms.id, type, image, price, details FROM dbo.rooms,dbo.transactions WHERE dbo.rooms.id=dbo.transactions.roomid and type='" & request.querystring("t") & "' and checkin >'" & request.querystring("c") & "' and checkout >'" & request.querystring("r") & "' and status='active' "
    sql_cmd.Prepared = true
    sql_cmd.Parameters.Append sql_cmd.CreateParameter("param1", 200, 1, 50, sql__MMColParam) ' adVarChar
    
    Set sql = sql_cmd.Execute
    sql_numRows = 0
    %>
    <%
    Dim Repeat1__numRows
    Dim Repeat1__index
    
    Repeat1__numRows = -1
    Repeat1__index = 0
    sql_numRows = sql_numRows + Repeat1__numRows
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <table border="1" cellpadding="1" cellspacing="1">
      <tr>
        <td>id</td>
        <td>type</td>
        <td>image</td>
        <td>price</td>
        <td>details</td>
      </tr>
      <% While ((Repeat1__numRows <> 0) AND (NOT sql.EOF)) %>
        <tr>
          <td><%=(sql.Fields.Item("id").Value)%></td>
          <td><%=(sql.Fields.Item("type").Value)%></td>
          <td><%=(sql.Fields.Item("image").Value)%></td>
          <td><%=(sql.Fields.Item("price").Value)%></td>
          <td><%=(sql.Fields.Item("details").Value)%></td>
        </tr>
        <% 
      Repeat1__index=Repeat1__index+1
      Repeat1__numRows=Repeat1__numRows-1
      sql.MoveNext()
    Wend
    %>
    </table>
    </body>
    </html>
    <%
    sql.Close()
    Set sql = Nothing
    %>
    Thanks!

  2. #2
    Join Date
    Jan 2008
    Location
    Florida
    Posts
    1,227
    So your table is not being populated. Have you verified the query returns results?

  3. #3
    Join Date
    Apr 2011
    Posts
    24
    yes if i replace the values of the queri with normal ones works fine

  4. #4
    Join Date
    Jan 2008
    Location
    Florida
    Posts
    1,227
    I don't understand. Does your query return results AS IS?

  5. #5
    Join Date
    Apr 2011
    Posts
    24
    Ok it works fine now bro. Just an if else statement left i will make a new post with the code i need help so dont ppl get confused tnx

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles