Ankit Ankit - 1 year ago 50
CSS Question

How to use data queried from the database to redirect to a new webpage via alert window?

Here is my question.(Sorry the title is confusing)

So, here is what I need to do. I am using PHP,html and MYSQL database.

  1. Query for some data from the database and print it out.

  2. Compare the data with some pre-defined values.

  3. If the value is not in the range, raise a notification alert box.

  4. Once, the user clicks 'OK'--> Open up a new webpage.

For example:

The query result '199' is stored in $result. If $result is less than 200; which is true in this case: then open alert window. Once the user clicks 'ok'. Then load a new HTML page to do further processing.

I am confused how to approach this. So,the $result is pulled through a php script and displayed. But, beyond that I am not able to use $result for comparison. Could anyone help me with this or point to a similar post?

Answer Source
  1. You can send queries to server using ajax calls
  2. Compare the results with predefined values
  3. If a match occurs,insert the code

window.location = '/some/url';

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download