I think the issue is that it's a string containing two values. Where in table one, the values are 1,2. Which refer to two seperate rows in the second table. As such inner join will not quiet work. You might be able to use mysql functions to do the explode for you, but I don't have any knowledge on that. You're along the right lines for doing it in PHP though.
$sql1 = mysql_query("SELECT impid FROM customer where c_id=1") or die (mysql_error());
$result1 = mysql_fetch_array($sql1);
$exp= $result1['impid']; // get 1, 2 from here
$array=explode(",",$exp); // cannot get the output from explode function, How can I get the sports name from here.
//now you loop over them and get the values for each id
foreach($array as $value){
$sql2 = mysql_query("SELECT * FROM customer where sport_id='".$value."'") or die (mysql_error());
//...
}
Hope that sets you on your way.
--edit--
If it's possible there is only one entry, you will want to check for the comma before you explode, otherwise it will cry at you.
if(strstr($exp, ',')){
$array=explode(",",$exp); // cannot get the output from explode function, How
}else{
//I put it into an array if it's a single value so you can still use the foreach, no
//processing code for a single record and a multiple record.
$array = array($exp);
}
foreach($array as $value){
$sql2 = mysql_query("SELECT * FROM customer where sport_id='".$value."'") or die (mysql_error());
//...
}