Question: [![error](https://i.stack.imgur.com/Uw9j2.jpg)](https://i.stack.imgur.com/Uw9j2.jpg)

I am trying to transfer some text files on SFTP Server using Putty command line option.

I have a batch file with the following commands:

```
(
echo cd /inbox
echo mput c:\temp\*.txt
echo bye
echo cd c:\temp\
echo del c:\temp\*.txt
) |echo open <username@ip> <port no> -pw password

```

However, when I execute the batch file I get stuck at "Keyboard interactive prompt from Server"

Appreciate any suggestions on how to get over this point to avoid manual intervention while executing this batch file?

Answer: 
You don't need to make 2 connections to the db for getting the same data. You could create a collection of objects and use them in place like such...

```
<?php
  $arr = [];

  $sql = "SELECT category.name as cat, article.name as art from category 
  JOIN article ON category.id = article.id";

  $query = mysqli_query($conn, $sql);

  while($row = mysqli_fetch_array($query)){
      $obj = (object) [
          "cat" => $row["cat"],
          "art" => $row["art"]
      ];

      array_push($arr, $obj);
  }

  mysqli_close($conn);
?>

<select name="category">
<option value="category">category name</option>
foreach($arr as $obj) {
    ?>
        <option value='"<?php echo $obj->cat; ?>"'><?php echo $obj->cat; ?></option>
    <?php
}

```

```
<select name="article">
<option value="articlename">article name</option>
foreach($arr as $obj) {
    ?>
        <option value='"<?php echo $obj->art; ?>"'><?php echo $obj->art; ?></option>
    <?php
}

```
You can prepare the strings that will hold the `<option>` in 1 loop, then simply echo them.

In example :

```
<?php
$sql = "SELECT category.name as cat,
               article.name as art
        FROM category 
        JOIN article
        ON category.id = article.id";
$query = mysqli_query($conn, $sql);
$articles = "";
$categories = "";
while($row = mysqli_fetch_array($query)) {
    $categories .= "<option value='" . $row["cat"] . "'>" . $row["cat"] . "</option>";
    $articles .= "<option value='" . $row["art"] . "'>" . $row["art"] . "</option>";
}
mysqli_close($conn);
?>
<select name="category">
    <option value="category">category name</option>
    <?php echo $categories; ?>
</select>
<select name="article">
    <option value="articlename">article name</option>
    <?php echo $articles; ?>
</select>

```