0

I am trying to get a value of row with a specific value of a mySQL DB.

This is how my row looks like

row | email     | uuid | device
 1  | [email protected] |xxxxxx|iPhone
 2  | [email protected]|yyyyyy|iPod

So for example I want to get the uuid in row 2, I have the email.

This is how my mysql_query looks like:

$result = mysql_query("SELECT * FROM users WHERE email = '{$email}'");
    echo(mysql_result($result, 0)); #0 is email, but I need uuid, so 1

but I only can get the email.

Does anyone know how to get the uuid?

1
  • Please, use PDO or mysqli_* functions mysql_* are deprecated Commented Jan 17, 2014 at 22:24

2 Answers 2

1

look into switching over to pdo or mysqli_. but otherwise why not:

 $result = mysql_query("SELECT * FROM users WHERE email = '{$email}'");
 while($row = mysql_fetch_array($result))
 {

      echo $row['uuId'] . "," . $row['email'] . "," . $row['device'] . "<br>";
      //or whatever data you want.
 }
Sign up to request clarification or add additional context in comments.

Comments

0

You can use

while ($row = mysql_fetch_assoc($result)) {
    echo $row['email'];
    echo $row['uuid'];
    echo $row['device'];

}

BTW start using mysqli_* functions mysql_* functions are deprecated.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.