It simply gets everyone with the first name "fred" from the database and echos out the first name and last name.
you specify each field from the database you want to retrieve from the database (as you should do for performance) and any places you would usually have a variable within the SQL query you put a question mark.
Then on $stmt->bind_results(1, 2, 2);
1: would be a string consisting of data types int (i), string (s), double (d), blob (b usually a file)
2: for each ? you would put your variable here.
e.g.
$name = (string) 'fred';
$age = (int) 10;
$stmt->bind_param('si', $name, $age);
Applied to the previous query if you added "AND age
=?" you would get everyone who is age 10 and called fred. It works in the order so the first ? is the first variable within the bind_param.
I used the object oriented style personally as I find it more effective and easier. However if you click the link on the previous post there is a procedural style mysqli.
You would use prepared statements for pretty much all SQL queries.
Make a test file and work with it on a small scale. The SQL isn't any different apart from ? instead of '$var' (you don't need to quote out the ?). Trial and error.