PHP + MySQL + Ajax Search or Data Framework - php

i tried several ajax/js "frameworks" and "data grids" to show some mysql data, but the problem is that i have to many columns (like 50) and some of then need to be links, images and also get the ID from the same query to create those links
the main features that im looking is good search, sort and filter
i dont have the time to make all of this script (and learn more about ajax), i'm not a php/mysql beginner but the problem is the ajax thing. so what im looking for is some script, framework, datagrid or anything that could make what i described, with less code edit as possible
if you can came up with another solution that already comes with ajax, that might be useful too

Maybe you want to try out jqGrid. Besides the jQuery version, they have a new all-PHP version that handles all the programming without AJAX. It might be exactly what you're looking for. It handles large data sets, and has a huge demo site with example code, including the PHP/MySQL back end.

Related

How to fetch data from website without API

I want to fetch all current and future courses form this website http://www.scfhs.info/cme_pd/search/index.php for example this queries http://www.scfhs.info/cme_pd/search/do_search.php to my iOS app , unfortunately they don't have an API.
How to get the data?
Check this out https://www.parsehub.com/ this will help you for sure
I've done this for a project, search for html scraping. There are a tools to do it that vary depending on your platform. Here is a start. Unfortunately if the page changes you have problems. In my case the pages would update in an inconsistent manner. It looks like most of the data you want is in option tags; that should make it easy to parse.
I would have made this a comment, but I'm not worthy yet.

Making dynamic forms work with my back-end database

I'm looking for some advice. I have been given a paper form with various criteria. I need users to be able to select a type of transport (Bus, Train, Taxi, Tram, Other).
Upon the selection, I need more fields to be produced in a form based on the user's choice. So questions about Bus times would be produced if the user selected bus.
The fields will be generated using PHP and MySQL. I have seen some JQuery solutions but I'm a little confused as to what my approach should be.
Can I use JQuery, PHP and MySQL together or can my problem just be achieved using just PHP and MySQL. Please note, the fields will be stored in my MySQL database already, I just them to be generated after the selection from the dropdown menu has been displayed.
No source code sorry everyone as I'm just asking about the approach I should take. I hope I've provided enough detail!
There is no way to achieve this solution with just PHP & MySQL. You would need to Ajax/JQuery to achieve this. Based on user's selection you need to send the data to server using JQuery Ajax and then server will send back the response that you need to show to the user.
This link should help you.
i think,
actually you can achieve this by only using php and mysql, jquery makes you easier when you play with DOM, with out it you can achive that goal, but need extra work with native javascript.
CMIIW

Fast autocomplete for drop-downs

I am using JQuery's autocomplete plugin, but it is not fast and also it's not that relevant to my site. I want an autocomplete like the www.hotels.com. How can I achieve this type of autocomplete? Are there plugins for it?
Hotels.com uses a custom JSON request/response. If you open up firebug you'll see the outgoing call:
Search for "London"
This call is fired immediately on keyup, and returns JSON data:
Response from Hotels.com
There's nothing particularly fancy going on otherwise, just a high powered server with an accurate database search. There's no autocomplete happening in Javascript though.
Thus, you rather want a dropdown filter instead of dropdown autocomplete? E.g. when you type "foo" you would like to get "foobar", "afooba" and "bazfoo" listed instead of only the starting-matches like "foobar" and "foobaz"?
If so, then I can suggest the Quickselect using Quicksilver algo or Flexselect using Liquidmetal algo. For what's worth, I've played with both about a year ago and decided to continue with the last one, because it was better customizeable to get it compatible with the other jQuery plugins (e.g. Validator and qTip).
What is it about www.hotels.com that you like? What data do you want to project into the autocomplete? Where would this data come from? You need to answer these questions before thinking about implementation details.
Good things costs money. In this particular benchmark exercise you're doing, if you look close enough, you'll be able to see that hotels.com uses the Yahoo JS framework and different custom functions...
80% of the work in autocompletion is done in the backend. THe backend needs to be really really quick to return query responses. I doubt if jquery is your problem. Use firebug's 'net' panel to understand how much round trip time is, and what the server latency is. Solve that problem. The rest is easy.
FWIW, I have had very good luck using GWT's suggestbox going directly into a oracle database (I dispensed with most of the web tier other than a very thin passthrough to get the responsiveness I was looking for). Response back to the user in approx 50ms

Linked pulldown lists using MySQL, PHP/JavaScript/Ajax/jQuery

I am quite new to web development and have a task to develop a web application that will basically show the user 5-15 pull down lists on one page, where each selection will limit the choices in all other lists. The user should be able to start with any one of the lists (so no set selection order) and when the user have selected something in each list or all parameters are otherwise locked by previous choices the user has to press the GO button and some calculations will take place, presenting a database selection. Basically it is a muliple parameter product selector application.
The relations between the lists are not simple, and could need calculated fields etc, and one list could affect the content of several others. The database behind will be MYSQL, probably a single large table, with perhaps 30 fields and 500-5000 rows. I will be using PHP, JavaScript and perhaps AJAX unless you have a strong reason not to.
I have done some research and found three ways to do this:
Send all data to the browser and handle the filtering etc client side with Javascript.
Send parameters back to the server after each selection and reload the whole form after each selection. Probably a littebit Javascript and most code in PHP.
Use AJAX to change all list content dynamically without reloading the whole form.
Since I am so new to this I have a hard time telling which way to go, what pitfalls there are etc...
I have some conserns:
A. Slow initial loading. Worst for #1?
B. Slow dynamic response. Worst for #2?
C. Complicated programming. Worst for #3?
D. Compatibility issues for different browsers and plattforms. Have no idea of which method is most likely to create problems...better if I use some Framework?
E. Could I even try to make something at least part-working for people with javascript turned off? (like selecting each list on a new page and having to press GO button each time)? (I think I can tell my users they must have Javascript on so no big issue....) Perhaps #2 is best here?
F. I think the specification of "free selection order" means I have to download most of the database initially, so perhaps I should try to avoid that option.....if I keep it I might as well use method #1, or???
G. It would be best to do as much as possible of the selction/filtering in SQL to allow future extensions by building custom SQL code, so that gives a big minus to #1...
H. Other pitfalls etc???
I have found tutorials etc for all three methods, but if you can point to good resources like this I would appreciate it, especially so I dont base my code on examples that are not smart/good/compatible....
1:
http://www.bobbyvandersluis.com/articles/unobtrusivedynamicselect.php
http://javascript.about.com/library/bl3drop.htm
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_20523133.html
2:
http://www.plus2net.com/php_tutorial/php_drop_down_list.php
http://www.plus2net.com/php_tutorial/php_drop_down_list3.php
3:
http://techinitiatives.blogspot.com/2007/01/dynamic-dropdown-list-using-ajax_29.html
http://www.webmonkey.com/tutorial/Build_an_Ajax_Dropdown_Menu
http://www.noboxmedia.com/massive-ajax-countryarea-drop-down-list/
http://freeajaxscripts.net/tutorials/Tutorials/ajax/view/Create_AJAX_Dynamic_Drop_Down_List_using_PHP_-_xajax.html
3+jQuery:
http://remysharp.com/2007/01/20/auto-populating-select-boxes-using-jquery-ajax/
Now to the question: Could anyone experienced in all these methods help me out a bit, with the evaluation of methods 1-3 above so I can choose one and get started on the right track? Also, will I be helped by learning/unsing a framework like jQuery+jSON for this?
Rgds
PM
I'd definitely recommend using AJAX with jQuery its tested in all of the major browsers and has simple calls that will make it a lot faster to code and you wouldn't have the browsers compatibility problems of normal JavaScript.
Send all data to the browser and handle the filtering etc client side
with Javascript.
You mentioned that your table has 30 columns and 500-5000 rows potentially? In that case it would not be a good idea to send that much data when the page loads as: 1. It will make the page slower to load and 2. It is likely to make the browser hang (think IE).
Send parameters back to the server after each selection and reload the
whole form after each selection.
Probably a littebit Javascript and
most code in PHP.
I'm not sure how this differs much from the third approach, but probably you mean that you need to reload the page? In that case it isn't likely to be a good user experience if they need wait for the page to refresh every time a drop down selection is changed..
Use AJAX to change all list content
dynamically without reloading the
whole form.
By far the best approach from a user's perspective as it makes filling out the form simple. Perhaps slightly harder to implement from your end, but as you would likely need to perform the same calculations with each of the solutions - might as well move them to a separate page that can be called by AJAX to retrieve your data. As others have mentioned, using jQuery for all your JavaScript/AJAX stuff is going to make things a hell of a lot easier ;)
My personal recommendation is to go with AJAX.
Raw SQL or not is really a question of what backend you are using.
You need to be able to set the relationships between the different selections. The population of the lists must be able to communicate with your backend.
The real issue here is how you implement the relationships between selections. I have no good answer here, it depends heavily on the backend and your administrative needs. It can be hard coded in PHP or configured via XML or via administrative interfaces and persisted to your database solution.
It's no easy task to make it fully customizable.
The reason why i suggest using AJAX is basically because you need to filter upon any change in any selection. That would mean either download a lot of unused information or a lot of page refresh. Going with ajax gives the user a smooth experience all the way.
jquery is a simpple way to use... You can also try a particular class called xajax..! These will make stuff easier.

rating system without reloading a page

i have a page on which i have some rating function like people who like the post can rate up or who don't can rate down.
on that link im calling a php file with some parameters passed in the anchor tag. Then in that php file im saving that rating with +1 or -1 (whichever is the case) in the database and after doing that im redirecting to that first page from where we have rated.
Now this whole function is reloading my whole page which i dont want.Is there any way with which i can do this rating without reloading the page,i want that when a person clicks on rate then just after click the rating should be shown according to what the user just did(+ or -) and that too without reloading the whole page.Is there any way to do that in php???????
Yes, it's called "Ajax". However, you don't do this on the server-side with PHP, you do it on the client-side with JavaScript. There are plenty of tutorials around, I suggest you take a look.
Note that there are many JavaScript libraries out there to make this extremely easy. I'd recommend taking a look at jQuery because I've personally found it to be the easiest to learn and use.
It seems a few answers have already been posted recommending different libraries. If you would like the avoid the (admittedly minimal) overhead of an included library, the following tutorial shows how to use a simple XMLHttpRequest object.
http://www.xul.fr/en-xml-ajax.html
The "xhr.responseText" is what you would receive back from the php processing (which would typically be done in a small, single-purpose script seperate from the primary page).
You can do this using Javascript or AJAX. There are plenty of free scripts online that can help you to do this without building the whole thing from scratch.
This page (http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=364) has a good list of different star rating scripts you can choose from. You can Google for more.
Here's another relevant tutorial I came across when answering some other question:
http://docs.jquery.com/Tutorials:Getting%5FStarted%5Fwith%5FjQuery#Rate%5Fme:%5FUsing%5FAjax

Categories