user1093513
user1093513

Reputation: 127

Run audio file when new enquiry is received PHP MySQL

We have a website where we receive enquiries for products which we sell online.

When a New enquiry is received to the support employee I want to run a audio file which alerts the person that a new enquiry got assigned to them.

The admin module works in PHP & MySQL.

The enquiry Table columns is as given below

  Enquiry_Id    |    EnqName  |  EnqEmail   |   Created_On   |   Attended_Status 

Thanks in advance

Upvotes: 0

Views: 132

Answers (3)

John
John

Reputation: 5344

I would create an AJAX script that runs periodically (let's say every minute) that

  • checks the status of the database: says whether a new order has come in the mean time
  • plays the audio file like nageeb suggested.

This assumes that employee has got a page that's always on.

If you give us more information I can update this.

Upvotes: 1

nageeb
nageeb

Reputation: 2042

Here's a bit of a quick solution, and not knowing too much about the structure of your application, this may or may not work...

  • I assume that there is probably some sort of page which lists the existing enquiries on your site that the representatives simply leave open... If so, set it to refresh every 5m or so.
  • In the for() loop that generates the list of enquiries, make sure that you have a column that would identify an enquiry as being "new" (perhaps the Attended_Status field?).
  • Put an if() statement in the for() loop and check for whatever would define a new enquiry, and if it resolves to true, just echo something like this: <object height="1" width="1" data="some_alert.mp3"></object> which should generate a 1x1 (essentially invisible) mp3 player based on whatever default audio player is installed on the user's computer.

It's the quickest/easiest way I can think of, as I said above, not knowing too much about your app.

Upvotes: 0

alanmanderson
alanmanderson

Reputation: 8200

An alternative solution is to use the php email function, so when you insert the row into the DB, lookup the representatives email and email him to notify him. (The email program can play an audio clip).

Upvotes: 0

Related Questions