If you give us a summary of what it is you're trying to achieve overall, we'll probably be able to help you more 🙂
Your if() statement seems OK - that is to say, you connect and see if there is a result, and if there is, you do something...BUT... you seem to be going about things in a slightly odd manner - why are you doing this: ?
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", $myrow["id"],$myrow["name"], $myrow["object_intr"], $myrow["object_descr_intr"], $myrow["activity_intr"], $myrow["activity_descr_intr"],$myrow["activityb_intr"], $myrow["activity_descr_intr"], $myrow["activityb_descr"], $myrow["objectb_intr"], $myrow["objectb_descr"], $myrow["hourb"], $myrow["hours"]);
I'm sure a person such as sxooter or roger ramjet will be able to decipher better than I, but you seem to be adding a lot of stuff in (which may be valid but too advanced for me!), plus you while() loop appears to come in too late...try this as a concept...
if (you have a result)
{
echo <table width=100%> //etc - start y our table if there is a positive result
while (the result meets the condition)
{
echo '<tr><td>' //start the cell
.$myrow['object_intr'] //add the content
.'</td></tr>'; //end the cell and repeat these 3 lines for each field you want to import
} //end the while loop which adds the content
echo </table> //end the table because there's no more content
} //end the if() statement because it has been satisfied
Another question - what is the role of these two fields (and others like them)?
object_intr
varchar(255)
object_descr_intr
varchar(255)
If it's a matter of an id and a description (or something similar) it might make more sense in the long term to make this relational - have a table for the main details, but relate it to other tables which have a description.
Another thing if you're having trouble is to always errorcheck: whenever you carry out a mysql() function, always use the mysql_error() function with it, so if it goes wrong, it'll say what's wrong with it.
mysql_select_db("intracom",$db);
$result = mysql_query("SELECT * FROM intracom WHERE name='$search'",$db);
would better read as:
mysql_select_db("intracom",$db) or die ("error in query ".mysql_error());
$result = mysql_query("SELECT * FROM intracom WHERE name='$search'",$db) or die ("error in query".mysql_error());
Overall, I'd suggest that you tell us exactly what it is you want to achieve and what code you have in place to do it. Then we can advise you more knowledgeably about the direction you perhaps might want to take. If you don't, we may end up giving you slightly irrelevant information!
best of luck though - php can be tricky at the beginning (I should know, I'm still ther!) but it's worth it in the end!