PHP SQL Select From Where

mysql, php

Solution

You need some additional PHP code (a call to mysql_fetch_array) to process the result resource returned by MySQL.

$result = mysql_query("SELECT name FROM users WHERE joined='$username'");

$row = mysql_fetch_array($result);

echo $row['name'];

Problem

I am having some difficulty running some SQL code. What I am trying to do is, find a row that contains the correct username, and then get a value from that correct row. This is my SQL in the php: ``` mysql_query("SELECT * FROM users WHERE joined='$username' GET name") ``` As you can see, it looks for a username in users and then once found, it must GET a value from the correct row. How do I do that?

Original source