I don't see what your problem is, except that you only went half-way there. Let's look at what each statement does:
1) $query="SELECT FROM contacts";
- This statement is simply a convenient way to store a query string in a variable. You could just as easily have skipped it: $result = mysql_query("SELECT FROM contacts");
2) $result=mysql_query($query);
- This creates a recordset called $result. The actual data isn't in a very useful format yet. NOTE: You may need to specify a database connection, which you'd get from a mysql_connect() statement. So you'd have: $result = mysql_query($query, $connection);
3) $row = mysql_fetch_assoc($result);
- This is the next step - fetching a row of data into an array called $row. NOTE: Though there are other ways to access a single field of data without this step, this way is generally the fastest.
4) echo $row['contact_name'];
- This will output an individual database field called "contact_name". You could also use print(), but I think echo() is more descriptive of output to a screen.
That's pretty much it (assumed you've correctly made your connection). Is that too complicated?