Old Pedant can be a little, uh, curt at times
He is right though, the mysql library is obsolescent, and will most definitely be removed in the near future. It is technically not obsolete yet, as it does still undergo maintenance officially (but no need to use that as a reason to keep
String usage is the actual issue for the queries. You must wrap anything that is a string with '' (or "" will work, but as Pedant pointed out a few years ago to me, the ' is the standard), and you shouldn't do that with things like integers (mysql is lenient by default, but can be configured strict).
Things like this will not work:
connect_server_db doesn't accept arguments, but that will not throw an error since PHP is designed with varargs (variable length argument lists) since it does not support overloading. The problem in particular with the above is the argument is literally the string '$connection', and not the variable. Its not required though since the function itself accepts nothing.
The validation blocks are technically wrong. If you fail the $uLength check, but pass the $pLength check, than you'll have no error message. Although this may be a moot point since there is no use of the $errorMessage anyway (there is no print).
On the plus side, although when you use the mysqli/pdo libraries with prepared statements you don't need to do it, the quotesmart function is correct. Most people do it backwards: if gpc is not enabled, then addslashes. This is incorrect; you must always remove slashes with stripslashes if magic quotes are enabled and THEN you must use real escape string as you do.
This is a problem, even though it won't seem like one:
Followed by later:
Sessions require cookies by default, and cookies require headers. Having the break with a white space is guaranteed to create output, so the session_start will push an error indicating headers have already been sent (and therefore fail to set the session, on default configurations). There is little loss in establishing a session at the very start aside from assigning an empty file, and it will never give problems, so I recommend you move it to the top of the script right after the <?php.
And of course, always add in development environments at the top (or if you can control it, at the php.ini level):
Which will show you any PHP errors. Not mysql ones though, those are done at the mysql_query call:
$result = mysql_query($sql) or die(mysql_error());
Dirty trick for error handling, but at least you'll know there's an error.