|
ввод в sql одновременно нескольких строк
|
|||
---|---|---|---|
#18+
Здравствуйте. нужно чтобы прописание в форме несколько строк переносились бы в скл. написал код, но точно не правильно. Помогите его исправить. Спасибо! index.php <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link date("H:m:s \m \i\s \m\o\n\t\h");"> <title>Text field</title> </head> <body> <form action="exe.php" method="post"> <p><b>Input:</b></p> <p><textarea type="text" name="input" id="input"></textarea></p> <p><button class="btn btn-success" type="submit">INPUT</button></p> </form> </body> </html> exe.php <?php $array = array($input); print_r($array); foreach ($array as $i => $input) { unset($array[$i]); } print_r($array); ////////////// $input = filter_var(trim($_POST['input']), FILTER_SANITIZE_STRING); //if(mb_strlen($input) < 1 || mb_strlen($input) > 90) { //echo "DLINA LOGINA NEDOSTATOCHNA"; //exit(); //} $country = filter_var(trim($_POST['input'])); $mysql = new mysqli('localhost', 'root', 'root', 'a_db'); $mysql->query("INSERT INTO aa (`aaa`) VALUES ('$array')"); if (!$link) { echo 'Код ошибки: ' . mysqli_connect_errno() . ', ошибка: ' . mysqli_connect_error(); exit; } $mysql->close(); ?> ... |
|||
:
Нравится:
Не нравится:
|
|||
05.07.2020, 14:33 |
|
|
start [/forum/topic.php?fid=23&fpage=8&tid=1459651]: |
0ms |
get settings: |
11ms |
get forum list: |
12ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
65ms |
get topic data: |
11ms |
get forum data: |
2ms |
get page messages: |
26ms |
get tp. blocked users: |
1ms |
others: | 298ms |
total: | 432ms |
0 / 0 |