Jump to content

fugix

Members
  • Posts

    1,483
  • Joined

  • Last visited

Posts posted by fugix

  1. Wow!!!

    Thanks for al the quick replies!!!

    Here is my AJAX code:

    <html>
    <head>
    <script type="text/javascript">
    function showHint(str)
    {
    var xmlhttp;
    if (str.length==0)
      { 
      document.getElementById("txtHint").innerHTML="";
      return;
      }
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
        }
      }
    xmlhttp.open("GET","ajax_test.php?q="+str,true);
    xmlhttp.send();
    }
    </script>
    </head>
    <body>
    
    <h3>Start typing a name in the input field below:</h3>
    <form action=""> 
    First name: <input type="text" id="txt1" onkeyup="showHint(this.value)" />
    </form>
    <p>Suggestions: <span id="txtHint"></span></p> 
    
    </body>
    </html>
    

     

    Btw to make it easier to understand for you all Voornaam means firstname in dutch.

    I'm going to use this query so people can fill in the first part of a name of a user and it gives some options.

    did Zanus modification not work for you?

  2. depending on how many rows you wish to grab at a time, to populate a table with values from your db..you will need to use a while loop to cycle through your db values if you plan on grabbing multiple models at a time.. if you simply want to grab the field values for a single row, you will need to use something like

    $row = mysql_fetch_assoc($query);

    $query being your mysql_query() resource.

    then you can create a table and populate it with the db values that you wish...eg

    <table><tr><td>Gain</td><td><?php echo $row['gain']; ?></td></tr>

    etc...now if you are wanting to grab multiple rows, you will need the while loop i stated above..

    while ($row = mysql_fetch_assoc($query)) {
    
      echo "<table><tr><td>Gain</td><td>{$row['gain']}</td></tr>";
    }

    hope this helps

  3. If he'd asked.. "what's the logically inept way of making this work?" - then yeah, you answered his call.

    and if he asked...hey i want to know the logic behind what im doing even though I am in a hurry in school and I really dont care or have 2 hours to talk to someone about the logic instead of getting the answer that I want...you did a good job.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.