problems with my Autosuggest project

Discussion in 'PHP' started by guif, Feb 2, 2009.

  1. guif

    guif New Member

    Joined:
    Jul 25, 2008
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    0
    I have problems with my Autosuggest project.

    I don't know to detect which is the value that I click.

    In my index.php i have this:

    Code:
    <div id="search-wrap">
       Seach values:<br>
       <input name="search-q2" id="search-q2" type="text" onkeyup="javascript:autosuggest2()" value="write a value...."/>
       <br><br>
    </div>
    
    To search the values i have the file "seach_values.php" and i have this:

    Code:
    <?php
       $searchq      =   strip_tags($_GET['q']);
       $getRecord_sql = "select pkey from TABLE where project = '10000' and pkey like '%".$searchq."%'";
       $getRecord      =   mysql_query($getRecord_sql);
       if(strlen($searchq)>0){
       echo '<ul>';
       while ($row = mysql_fetch_array($getRecord)) {
    ?>
    
    <li><a href="lib/consultas.php?accion=E" onclick="load('lib/consultas.php?accion=E','consulta');return false;">
    
    <?php 
       echo $row['pkey'];
    ?>
    
    </a>
    </li>
    
    <?php 
    }echo '</ul>'; 
    } 
    ?>
    
    This is correct, because i see the results when i write into my input box.
    But, when I click into one value (into <li>) the results all times are: "Query was empty"

    I put the case "E" from "consultas.php":

    Code:
    case 'E':      
    
    echo "<br>";
             echo my value is....;
    echo "<br>";
             echo $which is the value I clicked??????;
    echo "<br>";
    






    now, if i change this line:

    Code:
    <li><a href="lib/consultas.php?accion=E" onclick="load('lib/consultas.php?accion=E','consulta');return false;">
    and put:

    Code:
    <li><a href="lib/consultas.php?accion=E[b]&<?php echo $row['pkey']; ?>[/b]" onclick="load('lib/consultas.php?accion=E','consulta');return false;">
    I see the item of <li> name into the link but if i make a click, the echo don't give any result...
    help....
     
  2. guif

    guif New Member

    Joined:
    Jul 25, 2008
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    0
    Now, I see the element!!!
    I change this:

    Code:
    <li><a href="lib/consultas.php?accion=E" onclick="load('lib/consultas.php?accion=E','consulta');return false;">
    for:

    Code:
    <li><a href="lib/consultas.php?accion=E" onclick="load('lib/consultas.php?accion=E[B]&id=<?php echo $row['pkey']; ?>[/B]','consulta');return false;">
    if I put in case E:

    echo $_GET['id'];

    I see the element that i Clicked.

    but... i would like to insert a MySQl query:

    Code:
    $queEmp = "select pkey, UPDATED, reporter, resolution, summary from `jiraissue` where pkey like $_GET['id']";
    why did not run?
     
  3. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    PHP:
    $queEmp "select pkey, UPDATED, reporter, resolution, summary from `jiraissue` where pkey like '".$_GET['id']."'";
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice