I got 2 tables which I want to select via mysql_query in php.
- table1
columns: specialID, Name, Information, Start, created, byUser, ziparea
- table2
columns: ID, ziparea, cusID, title, contact, mail
$result = mysql_query("SELECT * FROM table1 JOIN table2 ON table1.ziparea = table2.ziparea WHERE table1.specialID='".$_REQUEST["specialID"]."'");
while($var = mysql_fetch_array($result)) {
}
table1 has exactly 1 entry for each ziparea from 01 to 99. table2 has multiple entries for zipareas.
The problem which seems to occur is that the result seems to be something like:
- table1-data --- data1 ---- data1 --- data1
- ziparea -------- 24 -------- 24 -------- 24
- table2-data --- data1 ---- data2 --- data3
means the data of table1 gets copied. I want the cells to be empty, because if I i.e. ask for table1.Name in php,
<?php echo utf8_encode($var["Name"]); ?>
it should only give 1 data... now it comes with 3 copies of that one data I need.
How can I solve this problem?