What you're actually asking about is how to manipulate strings.
To use your own example, I've got two elementary examples for you :
Ex. 1 :
$sql = "UPDATE table SET name='$var' WHERE id='A';
Ex. 2 :
$sql = 'UPDATE table SET name='.$var.' WHERE id="A"';
In example 1 the variable is actually parsed and inserted into the string $sql (because of the magic qoutes ")
In example 2 the $sql-string is concatenated using "." Some people say that single-qouted strings are faster ...
The last piece of advice : Study strings next week