Why is the script not working?

Hello! There is such script:

 <form method="post">
 <input name="name" id="name">
<br / >
 <span>Aliases (alias)</span>
 <input name="aliases" id="aliases" value="<?php $aliases ?>">
<br / >
 <span>Index files</span>
 <input name="index" value="index.php index.html" id="index">
<br / >
 <span>Encoding domain</span>
 <select name="encode">
 <option value="UTF-8">UTF-8</option>
 <option value="WINDOWS-1251">WINDOWS-1251</option>
 <option value>Not specified</option>
<br / >
 <span>the email Address.mail administrator</span>
 <input name="mail" id="email">
<br / >
 <input type="submit" value="create website">

ServerName $name
 ServerAlias www.$name
 DocumentRoot /home/$user/www/$name
 ServerAdmin $mail
 DirectoryIndex $index
 AddDefaultCharset $encode
 AssignUserID $user $user
 CustomLog home/$user/logs/$name.access.log combined
 ErrorLog home/$user/logs/$name.error.log

 //create a new Apache config from a template
 if (isset ($name, $aliases ,$mail ,$rootdir)) {
$fp = fopen($path, "w");
file_put_contents ($path, $config);
mkdir ('var/www/danila_p/data/www/test1.redcap52.EN');
 //write to the database new site
 $connection = mysqli_connect('localhost', 'xxxcpanadmin', 'xxx', 'xxx');
 $result = mysqli_query ($connection, "INSERT INTO {$dbtable} (name,alias,email,charset,indexfiles,userid) VALUES ('{$name}', '{$al}', {$mail}' , '{$encode}' , '{$index}' , '{$user}')");
echo 'Site created successfully.';

For some reason, after adding the lines
$connection = mysqli_connect('localhost', 'xxxcpanadmin', 'xxx', 'xxx');
 $result = mysqli_query ($connection, "INSERT INTO {$dbtable} (name,alias,email,charset,indexfiles,userid) VALUES ('{$name}', '{$al}', {$mail}' , '{$encode}' , '{$index}' , '{$user}')");

the form is refreshed, no error generates (via the console is also running - no errors), but the message about successful creation appears the config is not created.
July 2nd 19 at 17:47
1 answer
July 2nd 19 at 17:49
'{$al}', {$mail}'
Quote missed.
Errors the DB if there are errors in queries not raizada and issued in the result, so You think that all is well, no errors, and actually an error on the database server when executing Your query. In order to analyze it, analyze the $result from mysqli_query - marie.Gutmann commented on July 2nd 19 at 17:52
The error corrected, but still nothing happens, tried to delete rows script is also not working). - Glennie_Beie commented on July 2nd 19 at 17:55
How can I perform the $result ? - Glennie_Beie commented on July 2nd 19 at 17:58
For other types of SQL queries, INSERT, UPDATE, DELETE, DROP and others, mysql_query() returns TRUE in case of success and FALSE in case of error. - marie.Gutmann commented on July 2nd 19 at 18:01
found out why the script didn't work. before all the action went on the line if (isset ($name, $aliases ,$mail ,$rootdir)) {and the variable rootdir I removed from the script. - Glennie_Beie commented on July 2nd 19 at 18:04
Yeah exactly, that's the part I overlooked. and the fact that the inscription does not appear too overlooked :) - marie.Gutmann commented on July 2nd 19 at 18:07

Find more questions by tags PHP