How do I do this? Repeat MySQL Query


trying not understand how do: reuse same mysql query different results.

 

i have map i've scripted in jquery maphilight, when mouse on state, highlights, , when click it, opens modal box. want populate modal box stores in state.

 

so have mysql database several tables: importantly, "store descriptions" , "locations" (linked "store descriptions" via foreign key.) tables named "store_descriptions" , "store_locations" respectively. query says this:

 

select store_descriptions.store_name, store_descriptions.store_link, store_descriptions.locat_id, store_locations.locat_location, store_locations.locat_id store_descriptions, store_locations store_descriptions.locat_id = store_locations.locat_id

 

all fine , dandy. gives me result set can see stores , locations. can make new query adding "and store_descriptions.locat_id = 6". (6 is, say, louisiana.) shows me stores in louisiana, , can use populate modal box louisiana.

 

however, cannot 50 times! puts such drain on database page takes forever load. there simpler way this? i'd appreciate being shown direction go in learning how solve problem.

 

p.s. scripting in php.

you don't hardcode state id in clause. instead, use either variable or placeholder , pass state id value in querystring. php code retrieves value , uses in clause. have dw code you, check out master/detail pages.



More discussions in Develop server-side applications in Dreamweaver


adobe

Comments