Search MySQL Database - php

Hey, I have put together an iPhone web app and i'm currently reading and displaying data from a MySQL database. I have added a search bar to this page and was wondering what the best way would be to search the content on the page.
My page

The best way to do this would be via AJAX. When you click "Search", make an AJAX call with the supplied search string to a PHP page. The PHP page will then take that string and make a MySQL call that will return the data set. The PHP can then return the dataset back to your HTML page.

Related

How do i create a site that uses menus/radio buttons to extract data from MySQL Database?

I've managed to construct a webpage template that has all the elements for a home page but I want to use the data in my database to then submit to produce results coming out once submitted.
When I choose the menu (which has successfully come through from the database) when I click submit and have a second php page to make this submit work, I do not get any results from the database or at best showing what I have selected.
What code do I need to produce results on submit page that would hold all the data selected?
I really am a beginner at this and using PHP, HTML, and Dreamweaver as my builder.
At first you have to understand HTML form methods and how to access form data using PHP.
For getting the values of the select box you can go to this link.
Get select box value using $_POST

PHP sending data to the redirected page

I am building a small website for viewing and amending data entries in a database.
I have a form where a user can select the table they want to view in a drop down select.
On submit I call a php script which handles pulling the data and then redirects to the .html site on which I want to display the results.
I know that my script works in that if I do not use the header redirect the correct results are printed.
I am wondering how I can access the data from the website I'm redirecting to so that I could display them.
I would welcome any alternative suggestions.
The .html implies static data, are the tables always static or are you loading from a data source (mysql, etc)? If you're just trying to load a static HTML page from a drop down, then maybe you should just use javascript?
http://webdesign.about.com/od/javascript/f/blfaqddredirect.htm
Unless I am mistaken on what you are attempting to do.

How to execute mysql_fetch_row() upon a button click

I am tying to put some user data from the database using php.
The database contains so many record and i am displaying it using mysql_fetch_row() and this gives me the fields of first row.
Now the problem is a have two buttons namely next and previous. And when a click next the fields in the next row has to be obtained the they should be inserted into page without loading the page once again. I am facing problem with this.
I am using php for server side programming and html, css for client side programming.
I think that no one will give you the answer. Too many to write. You need to read about ajax (this is the technology that will allow you to do some action without page reloading).
You need to write javascript(you can use some library like jquery) function which will open some php page with the data that you want and then update your site.
Here you have some nice tutorial:
http://www.w3schools.com/jquery/jquery_ajax_intro.asp

Pull MySQL Database Value Continously

I am storing a number in a MySql Database Table, specifically a row called "open" whose field is an integer value that nearly continuously changes. I want to be able to continuously pull this value and display it on the frontend HTML page and put it in a table, called something like "live values". I want the numbers on the frontend to change without need for page refresh and I am trying to figure out how/if I can do this.
Is it possible to pull the value of the data to the frontend, using PHP, asynchronously?
You need to program a little bit of JavaScript in the HTML itself, which will periodically poll a PHP page. This PHP page should access the MySQL DB, retrieve the number, and send it back.
Here's Google AJAX tutorial which might help you: http://code.google.com/edu/ajax/tutorials/ajax-tutorial.html
Simpler PHP + AJAX examples:
http://simpletutorials.com/?path=tutorials/javascript/simple_ajax
http://www.w3schools.com/php/php_ajax_database.asp

View live updates from MySQL database?

I want to create a page where people can insert some text, hit enter, and the text be stored in a MySQL database. I can do this, but I want to be able to load a page, enter a password, and see a list of all the info in said database, then whenever something is added to the database, it's added to the list on the page, without me needing to refresh the page or setup some javascript code to refresh the page every five seconds.
I believe Satya has it correct in suggesting that you use Ajax in order to refresh the data without refreshing the page. You can have it request updated information from a php script which queries your database for the data you wish to display, and then sets the elements on your page accordingly.
this is probably the best way for you to implement ajax calls using javascript
http://api.jquery.com/jQuery.ajax/
Or you an simly do it with the help of setInterval() function. You can call an html code in a div using
$('#id').html("<htmlcode></htmlcode>");
Example : http://jsfiddle.net/ipsjolly/995PJ/6/

Categories