PHP script to change ringgroups don't connect MySQL db

I have made a .php script to change easy the ringgroups (for the costumer).
But the script can’t connect the database.

I use port 3306 for MySQL, but no output, here is the script.


<?php $host = "localhost"; //database location $user = "voip"; //database username $pass = "voip123"; //database password $db_name = "voi"; //database name //database connection $link = mysql_connect($host, $user, $pass); mysql_select_db($db_name); //sets encoding to utf8 mysql_query("SET NAMES utf8"); ?>


<?php include ("connection.php"); $code = "SELECT * FROM `ringgroups` "; $ans = mysql_query($code); while ($teksten = mysql_fetch_array($ans)) { echo $teksten['grpnum'];
echo $teksten['grplist']; } ?>

What going wrong, what can i do the make is possable to change the ringgroups form a small page/script.


It is really, really not recommended that you edit the database directly. Instead, you want to call the api’s that can accomplish the same thing in a much safer way. Start with a goggle search for FreePBX Bootstrap, and than have a look at the ring group functions.