-2

I need only the values of one column in an array. Without php I would use "SELECT valueX FROM tableY". This does not work with php. I only get one result. This is what I have:

$salty = "SELECT salt FROM login";
$salts = mysqli_query($connection, $salty);
$validsalts = mysqli_fetch_array($salts);
4
  • question lack detail, try echo in loop!! Commented Aug 10, 2016 at 8:53
  • do u have only single record in your database ? Commented Aug 10, 2016 at 8:53
  • var_dump($validsalts); may be of use Commented Aug 10, 2016 at 8:54
  • you can use loop [while loop for example] to get multiple records while($validsalts = mysqli_fetch_array($salts)){} Commented Aug 10, 2016 at 8:54

1 Answer 1

1

You have to make a loop iteration for fetching the all value.

for example.

$salty = "SELECT salt FROM login";
$salts = mysqli_query($connection, $salty);
while($validsalts = mysqli_fetch_array($salts))
{
    echo $validsalts['salt'];
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.