jabirshah1 Posted January 3, 2014 Share Posted January 3, 2014 HI can anyone help i have a error with my code it allows me to run the while loop to echo my variables from a SQL table but wont run the javacript replying there is a error here are my 2 forms of coding. radio_search.php <?php include "sql.php"; if ($_GET[search] == '') { $where = ""; } else { $where = " WHERE manufacfurer LIKE '%".$_GET[search]."%' OR model LIKE '%".$_GET[search]."%' OR further_details LIKE '%".$_GET[search]."%' id LIKE '%".$_GET[search]."%' angle LIKE '%".$_GET[search]."%' type LIKE '%".$_GET[search]."%' OR country LIKE '%".$_GET[search]."%'" ; } $dblink = mysqli_connect($mysql_host, $mysql_user, $mysql_pw, $mysql_db); $sql_query = "SELECT * FROM sharpeners".$where." ORDER BY id,manufacturer, model"; $query_result = mysqli_query($dblink, $sql_query) OR die ("Cannot read from Product List ".mysql_error($dblink)); $num_of_rows = mysqli_num_rows ($query_result) or die ("No entries yet."); echo "<div align=center><b>There are $num_of_rows Sharpeners in the DB</b></div>\n"; ?> <div align ="center"> <p><p><p><p><p><p></p></p></p></p></p></p> <table border="5" cellspacing="8"> <thead> <tr> <th><U>Sharpener ID:</U></th> <th><U>Angle:</U></th> <th><U>Manufacturer:</U></th> <th><U>Model:</U></th> <th><U>Type:</U></th> <th><U>Country:</U></th> <th><U>Further Details:</U></th> </tr> </thead> </div> <?php while ($row = mysqli_fetch_array ($query_result)) { echo "<tr><td>".$row["id"]."</td><td>" .$row["angle"]."</td><td>".$row["manufacturer"]."</td><td>" .$row ["model"]. "</td><td>" .$row ["type"]. "</td><td>".$row ["country"]. "</td><td>".$row["further_details"]."</td></tr>\n";} ?> </table> search_radios.php <?php include "sql.php"; ?> <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function ajaxFunction(){ var ajaxRequest; try{ // Opera >=8.0, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // still doesn't work alert("Your Browser is not supported."); return false; } } } ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('ajaxDiv'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var radio = document.getElementById('radioSearch').value; ajaxRequest.open("GET", "radio_search.php?search=" + radio, true); ajaxRequest.send(null); } //--> </script> <?php // End Ajax ?> <p> <form> <input type="text" id="radioSearch" name="search" onkeyup="ajaxFunction();" autocomplete="off" /> <input type="submit" value="Submit" /> </form> </p> <div id='ajaxDiv'> <?php include "radio_search.php"; ?> </div> </body> </html> Thankyou Quote Link to comment https://forums.phpfreaks.com/topic/285064-javascript-help/ Share on other sites More sharing options...
jazzman1 Posted January 4, 2014 Share Posted January 4, 2014 I don't see any js errors in my firebug. Quote Link to comment https://forums.phpfreaks.com/topic/285064-javascript-help/#findComment-1463788 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.