2 Replies - 1276 Views - Last Post: 10 July 2009 - 01:03 PM Rate Topic: -----

#1 colorodo13  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 16-February 09

Play a sound on mysql insertion

Post icon  Posted 10 July 2009 - 12:36 PM

Hello everyone:
question I have a basic chat room that uses a mysql database, what I want to know is there a way when someone types something and hits sends to flash the http tab to show incoming data. I hope I explained it right.

Thanks
Is This A Good Question/Topic? 0
  • +

Replies To: Play a sound on mysql insertion

#2 Wimpy  Icon User is offline

  • R.I.P. ( Really Intelligent Person, right? )
  • member icon

Reputation: 159
  • View blog
  • Posts: 1,038
  • Joined: 02-May 09

Re: Play a sound on mysql insertion

Posted 10 July 2009 - 12:53 PM

If you somehow let the client know that there has been an insertion into the database you could play a sound using javascript. You can't however use PHP for it since PHP is run on the server only.

View Postcolorodo13, on 10 Jul, 2009 - 09:36 PM, said:

Hello everyone:
question I have a basic chat room that uses a mysql database, what I want to know is there a way when someone types something and hits sends to flash the http tab to show incoming data. I hope I explained it right.

Thanks

Was This Post Helpful? 0
  • +
  • -

#3 William_Wilson  Icon User is offline

  • lost in compilation
  • member icon

Reputation: 205
  • View blog
  • Posts: 4,807
  • Joined: 23-December 05

Re: Play a sound on mysql insertion

Posted 10 July 2009 - 01:03 PM

Depending on how/where you insert, the code could be generated with PHP, but it would be html.

You could do something like:
$sound = "<embed src='ding.wav' height=0 width=0 hidden=true autostart=true loop=false volume=100 />";

if(mysql_insert_worked) //some condition that knows if it was successful
{
	 echo $sound;
}



This can be done on a redirected page that only saves the file, but make sure you leave enough time before the next redirect or the sound file may not be opened in time.

If you are doing it via ajax then you will need to use js to add the embed code instead.

Your solution is dependant on how you get to and from the insert page.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1