in DB i have two tables named my one and table one there is a colum named by name and in table two there is colum named by address. when i run the query it show the result but the problem with this is that it show same result two times. can any one pleaze help me out.

in database table is like that
name address
ali1 hyderabad
hyder1 karachi



// Make a MySQL Connection
// Construct our join query
$query = "SELECT,two.address FROM one,two";
$result = mysql_query($query) or die(mysql_error());

echo " name "."address";
echo "<br />";

while ($row=mysql_fetch_array($result)){


	echo $row['name']. " - ".$row['address'];

echo "<br />";




name address
ali1 - hyderabad
hyder1 - hyderabad
ali1 - karachi
hyder1 - karachi

you should have an identifier on one and two that tie the two tables together like an id, or the name.
your query would look something like

$query="SELECT,two.address FROM one,two where";
// or some identifying field that ties that particular address to that particular name
$query="SELECT,two.address FROM one,two where";

it's a little more complex than that but you need to tie the address to the name record in some other way

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.