Jump to content

Php


beechy34

Recommended Posts

i does any one know how to get a drop down list to read something straight from an sql database. this is what someone has asked me to do in their words"i need the drop down list with the cars listed to read the cars straight from my database"can you helpthankyou

Link to comment
Share on other sites

I'm not completely sure I understand. I think you mean this: A user sits at the browser and loads your page. A <select> element contains a list of cars. When the user selects a car, the entire database record for that car "appears" in the browser.Assuming that's the situation, my first question is, how many cars, and how big is the database? If the amount of data is small (under 10K) it may be more efficient just to load EVERYTHING into your document as a series of javascript objects when the page initially downloads. Then let javascript do the work. The initial download might be affected by a second or two, but the user response will be instantaneous.If it's bigger, then AJAX is your best solution.Most of the AJAX tutorials focus on the client side connection. You'll also want a way to return data from the server to the browser. I find JSON strings are very efficient. Basically, your PHP script generates the text to create a bunch of javascript objects/arrays/whatever, and passes all that back to the browser. Running that text through eval() turns it into the actual objects.Returning the data as XML can also work.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...