Well, the error would be most likely caused by a failure in the query. It is basically telling you that your variable $result is not a valid result from a query, and as such, the printf commands are failing.
At least thats my best guess as to what is going on. I would also need to see line numbers and surrounding code...but I am guessing you did all that pruning already?
anyway, I think I see what you are trying to do here...here is how I would handle it, YMMV:
<?php
$db = /* some connection handler */;
$contest = "roundTable";
$query = "SELECT * FROM contests WHERE ContestName = $contest";
$result = mysql_query($query,$db) or die("There was an error fetching results.");
/*
* since there will most likely be many results, we need to loop through them
*/
while ($data = mysql_fetch_row($result,$db))
{
print "<p>".$data['Contestant_ID']." ".$data['fname']." ".$data['lname']."</p>\n";
}
?>
You can see obviously that I am not a big fan of printf, but you can certainly adjust what I am doing. I put the query into its own variable just for the sake of keeping that block of code readable, and then implemented a quick trap that will prevent the error you were seeing if there happened to be something wrong with the query. There are much better ways to handle that so it wont just kill the script outright, but I will leave that as an excercise to the reader 🙂
So, what I did was retrieve all the possible rows of data for my query, and then I step through them one at a time, displaying the appropriate data on each pass. I just wrapped them all in <p> tags to organize them slightly.
EDIT: oops, need to proofread better 😃