User send to site acesskey, in MySql in table users there is his data(id, name, acesskey, friends). How to select he ID and echo from table messages all message where id_from = id?
Asked
Active
Viewed 46 times
-2
-
if your input is acesskey then your search criteria should contain acesskey, not id. – Umashankar Das May 28 '17 at 05:13
-
I try $id = mysqli_query( $dbc, "SELECT id FROM users WHERE acesskey=$acesskey"); And echo $id – Mr Lucky Tomas May 28 '17 at 05:15
-
can you explain what exactly you want to display and from where you will get it? – Umashankar Das May 28 '17 at 05:16
-
http://imgur.com/a/p2Wsv Its image my tables. I need get from users ID by acesskey and search messages from this ID – Mr Lucky Tomas May 28 '17 at 05:18
1 Answers
0
Basically, you need to combine 2 select query results. Try looking at this. It might explain everything.

Umashankar Das
- 601
- 4
- 12
-
I get data. How to correct display this data? I have 2 data from 1 table, while($row = $from->fetch()) { echo $row['name'] . "\n"; } It code give only 1 data – Mr Lucky Tomas May 28 '17 at 07:25
-
Try something like this. while($row = $result->fetch_assoc()) { echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "
"; } – Umashankar Das May 28 '17 at 12:45