Hello! First post ever and I believe some of you will laugh at the question but, hey, we go to start somewhere, right?
So, I'm really new to MySql and PHP also, but with the help of the almighty Internet I managed to learn a few things. So, my question is actually very simple: how do we know the id of some element in our table in order to do a query? Allow me to explain: for example, we have a table named "people" with 3 columns: "name", "age" and "id". In the html page we click on the name and then I want it to show me the age of that person. So, I thought that we went to php and did something like this:
$name = $_POST['name'];
query = "SELECT people FROM people_db WHERE name='".$name."'";
$do_it = mysql_query($query);
But I found out that that's not a good practice, and what I should do was to do the query based on the id, because it's a unique value on the table. But how do we know what's the id before we do the query? Any help you could provide I'd be gratefull.