- Edited
Correctly converting old DreamWeaver produced php code from using the mysql extension to using the mysqli extension is going to be a lot of work, because you should supply the connection variable as a parameter to each GetSQLValueString() call, in case you have multiple different database connections in your application. Given the specific name of the connection variable you have added to the mysqli statements, I suspect that you may have more than one connection in your application.
If you are sure you don't have and will never have more than one database connection, you can use the GLOBAL keyword to access the connection inside the GetSQLValueString() function definition. You should also be getting an undefined variable error in addition to the error you are receiving. Perhaps the error_reporting on your system isn't set to E_ALL?
Next, the logic in this function was never correct and the conversion you did to mysqli has added a problem -
1) There was never a php version 6 and the logic test for it was never needed in this code. The get_magic_quotes_gpc() function (currently) exists and returns the correct value for the stripslashes logic to work for all current and past versions of php. However, magic_quotes was removed in php5.4, which was a long time ago and no one should be using such an old version, so there's no real need for the stripslashes logic at all.
2) There is no mysqli_escape_string() function at all and the logic trying to pick between mysqli__real_escape_string() and mysqli_escape_string() won't work correctly. If the mysqli extension is not present, there will be no mysqli_real_escape_string() function (there won't be a mysqli connection either), and the logic will attempt to use mysqli_escape_string() which doesn't exist and will result in a fatal runtime error. The code should just directly use mysqli_real_escape_string().
Lastly, if you are going to the trouble of converting old code, your time would be better spent converting it to use the php PDO extension and to use prepared queries when supplying data values to the sql query statement. Doing this will eliminate the GetSQLValueString function and its calls entirely and it will actually simplify the sql query syntax, while only adding one statement to the code, for the prepare() method call.