Jump to content

Search the Community

Showing results for tags 'php sql ajax'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 2 results

  1. Hello I am a real newbie and I tried to use the exemple on the w3schools forum but it does not do what I want so if someone could help me and point me out in the right direction I would be so grateful here is my thing I have a sql database with a schedule I want to be able to build a drop down menue user can select a campus from that sql table and return all the data for that selected campus the most magic option would be for them to be able to do multiple select so they could select the campus AT the moment I am only working with one select option but it really does not work :-) here is the php <!DOCTYPE html> <html> <head> <style> table { width: 100%; border-collapse: collapse; } table, td, th { border: 1px solid black; padding: 5px; } th {text-align: left;} </style> </head> <body> <?php $q = intval($_GET['q']); $con = mysqli_connect('localhost','peter','1234','frozzie_orientation'); if (!$con) { die('Could not connect: ' . mysqli_error($con)); } mysqli_select_db($con,"orientation_schedule"); $sql="SELECT * FROM orientation_schedule WHERE FID = '".$q."'"; $result = mysqli_query($con,$sql); echo "<table> <tr> <th>location</th> <th>title</th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['location'] . "</td>"; echo "<td>" . $row['title'] . "</td>"; echo "</tr>"; } echo "</table>"; mysqli_close($con); ?> </body> </html> here is the html <!DOCTYPE html> <html> <head> <script> function showUser(str) { if (str=="") { 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","getuser.php?q="+str,true); xmlhttp.send(); } </script> </head> <body> <form> <select name="orientation_schedule" onchange="showUser(this.value)"> <option value="">Select a campus:</option> <option value="1">Lismore</option> <option value="2">Coffs Harbour</option> <option value="3">Gold Coast</option> </select> </form> <br> <div id="txtHint"><b>Your Campus will be listed here.</b></div> </body> </html> Thank you very much
  2. Hi,I am trying to access a database using the a html 5 select field for a mobile app for college. I have been trying to use the w3schools tutorial found here:http://www.w3schools.com/php/php_ajax_database.aspI have essentially copied the tutorial exactly but I keep getting the error:Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\ajax\getuser.php on line 25I cant actually reproduce the tutorial without errors which is very frustrating as I need to be able to get this to work within a html 5 phonegap app. Any help would be greatly appreciated.Many thanks
×
×
  • Create New...