$q="SELECT t1.gebruikersnaam
FROM tbel_leden as t1
Left join instellingen as t2 on t2.ledenid=t1.ledenid
WHERE t2.livetracking=1";
or
$q="SELECT t1.gebruikersnaam
FROM tbel_leden as t1
join instellingen as t2 on t2.ledenid=t1.ledenid
WHERE t2.livetracking=1";
it depends on what you want to get from DB. It's recommended to read a SQL spec about JOIN.
<?php
$con = mysql_connect("localhost","username","password");
if (!$con){
die('We don't have a connection: ' . mysql_error());
}
mysql_select_db("yourDB", $con);
$q = "SELECT t1.gebruikersnaam FROM tbel_leden as t1 Left join instellingen as t2 on t2.ledenid=t1.ledenid WHERE t2.livetracking=1";
$result = mysql_query($q);
while ($row = mysql_fetch_array($result,MYSQL_NUM)){
echo $row[0]."<br />";
}
?>
you should try this code snippet.