I'm wondering about your table names. If the example is true, then you are using integers as table names. I suspect that the number is being morphed into a double somewhere along the way. Try using quotes around it to force it to a string name instead of a binary number.
Try this , or something like it:
$sql="SELECT * FROM '$table' WHERE id='$id'";
Use ths syntax when developing:
$results=mysql_query($sql) or die ($sql . '<br />' . mysql_error());
It will display your query and the error text if your query fails. Usually it some slash/stripslash problem or other and you need to know exactly what was being passed to the DBMS.