How to filter MySQL result set using AJAX?

Hello Pullo, i see your javascript php and ajax demo form here and its awesome, and i used your code but after integrate your code my all result showing great but my checkbox checked all by default, but i want to try to show all result with no default checked and after i check on particular checkbox then mobiles brands will show.
Thanks in advance

Hi,

Welcome to the forums :slight_smile:

Can you post your code along with a dump of your db and some sample data?

Thanks for your reply, my code is done and its working properly, i solve this from my end.
But i have another question, my structure is showing in <tr><td> JSON_CODE </td></tr> means in this format but i want to try to show in this format but problem is that i don’t know where and how i should put the HTML structure code, in PHP or AJAX code? I used the same code which is provide by you like http://www.sitepoint.com/forums/showthread.php?1184333-Use-AJAX-to-filter-MySQL-results-with-multiple-checkbox-option&p=5608894&viewfull=1#post5608894 , sorry still I’m not using image code or it is not in your code but i want to show image in the given screenshot style, please help me what should i do.
Thanks

Hi,

Store the image path in the database and parse it as normal.

Ya I can but in the given example, your html structure code in ajax which is
({ tbl_row += “<td>”+ v +“</td>”;
})
tbl_body += “<tr>”+tbl_row+“</tr>”;

if I want to show this structure in php then how can i do, can you give me some example or in ajax how to put html structure, please guide me because ajax is new for me.
Thanks In advance

I’m sorry, I don’t get what you mean by “show this structure in PHP”.
I had understood you to mean that you want to show images with your product descriptions.

Are you asking how to realise the layout in the image you provided (as opposed to my example which used a table)?

Sorry for my bad english and could not describe my real problem in standard way but yes you are right, i want to set a layout which is given in image, can you please describe it?
Thanks

Hi,

I don’t have time to make a complete layout for you right now. Sorry :slight_smile:
Why don’t you try and make it and post back here if you get stuck.

You need only concentrate on the HTML and CSS (using some dummy text/images), then we can work out how to insert the product details in a second step.

Okay I’m trying.
Thanks for your reply

Hello Pullo
Sorry for again, I have another query, you are using PDO connectivity for connecting to DB, can we use simple mysql_connect function for connectivity to DB for this same script(filter MySQL result set using AJAX?)?

Hey,

Don’t use PHP’s deprecated mysql extension.
Use mysqli (MySQL Improved) or PDO (PHP Data Objects) instead.