no, it's cart.cookieId = '" . GetCartId() . "' Basically what thats doing is only looking at cookieId in the cart table where the values are the same as the value returned by the function GetCartId().
Because it's a function you cant put it straight into the SQL statement (since then MySQL would think it was a mysql funciton, which it's not). SO you break out of the SQl (with the ") and then put the GetCartId() function in, and then go back to your SQL statement. You also need the ' around the value so that MySQL doestn get confused.
You'll see it more easily if you use the [php] and [/php] tags around your code:
$result = mysql_query("select * from cart inner join items on cart.itemId = items.itemId where cart.cookieId = '" . GetCartId() . "' order by items.itemName asc");
the colour coding should make it a little clearer for you.