Rewritten for mysql

mysql PHP extension is deprecated, rewritten for mysqli
This commit is contained in:
varnav 2015-08-05 13:59:43 +03:00
parent ce2c7b816c
commit ec95a2562d

View file

@ -12,10 +12,10 @@
Print "</BR>"; Print "</BR>";
echo "List of Databases: </BR>"; echo "List of Databases: </BR>";
{% for host in groups['dbservers'] %} {% for host in groups['dbservers'] %}
$link = mysql_connect('{{ hostvars[host].ansible_default_ipv4.address }}', '{{ hostvars[host].dbuser }}', '{{ hostvars[host].upassword }}') or die(mysql_error()); $link = mysqli_connect('{{ hostvars[host].ansible_default_ipv4.address }}', '{{ hostvars[host].dbuser }}', '{{ hostvars[host].upassword }}') or die(mysqli_connect_error($link));
{% endfor %} {% endfor %}
$res = mysql_query("SHOW DATABASES"); $res = mysqli_query($link, "SHOW DATABASES;");
while ($row = mysql_fetch_assoc($res)) { while ($row = mysqli_fetch_assoc($res)) {
echo $row['Database'] . "\n"; echo $row['Database'] . "\n";
} }
?> ?>