Jump to content

seblil

Members
  • Posts

    1
  • Joined

  • Last visited

Profile Information

  • Location
    Sweden

seblil's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. First off, thanks for letting me into the forums. Excuse a newbie but I have a question about fetching data from a database with PHP and AJAX. Let's say I wanted to fetch data from the database like in this example from W3Schools, but I had modified the dropdown to for example fetch all entries with last name Griffin, Swanson or Quagmire. I made the q variable take a string instead of an integer. $q = strval($_GET['q']); Now I want to expand the SQL query to also take another condition. "SELECT * FROM user WHERE LastName = '".$q."' AND Hometown = '".$q2."'"; I understand how to build the query and that I need to declare another variable (q2), but how do I modify the AJAX request? xmlhttp.open("GET","getuser.php?q="+str,true); Also, would I need to have a submit button now that there are two conditions? Thanks!
×
×
  • Create New...