Question

I have an mysql database named gpstracking. There are a couple tables in this database: positions and devices.

What is the issue. On the table positions we have a row called device_id.

On the table devices we have a row called id.

On the table devices we have a row called name.

The device_id and id rows are the same id's, they are pointed to get the name. My problem is, how to in PHP a loop or something to get the name when compare the 2 id rows.

So example:

device_id row:
1 
2
3
4
5

id row:

1      Jan
2      Klaas
3      Piet

So if i fetch the information from table with the device_id row, i want that the script can get the name from the device_id.

Can someone help me ?

Était-ce utile?

La solution

You mean this:

Select * from positions
join devices ON positions.device_id = devices.id
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top