mysqli_real_escape_string
3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 20, 2012 (RSS)
By terryally - April 20, 2012
Hi guys,
My server is now using PHP 6, therefore I want to know whether I can use <mysqli_real_escape_string> in my form validation and if so what is the link identifier should I use considering that the database base connection is already called in the first include that is generated by CMSB?
Thanks
Terry
My server is now using PHP 6, therefore I want to know whether I can use <mysqli_real_escape_string> in my form validation and if so what is the link identifier should I use considering that the database base connection is already called in the first include that is generated by CMSB?
Thanks
Terry
Re: [terryally] mysqli_real_escape_string
By Dave - April 20, 2012
Hi Terry,
Do you mean PHP 5? PHP 6 hasn't been released yet, so any version out there would be very early alpha/beta and not suitable for a production environment.
Also, for compatibility we use mysql_* function not mysqli_* functions. So you can use mysql_real_escape_string() without a connection identifier and it will use the current connection. Eg: mysql_real_escape_string( $record['title'] );
And the CMSB codebase has a shorter function that we often use called mysql_escape() that does the same thing.
Hope that helps!
Do you mean PHP 5? PHP 6 hasn't been released yet, so any version out there would be very early alpha/beta and not suitable for a production environment.
Also, for compatibility we use mysql_* function not mysqli_* functions. So you can use mysql_real_escape_string() without a connection identifier and it will use the current connection. Eg: mysql_real_escape_string( $record['title'] );
And the CMSB codebase has a shorter function that we often use called mysql_escape() that does the same thing.
Hope that helps!
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com
Re: [Dave] mysqli_real_escape_string
By terryally - April 20, 2012 - edited: April 22, 2012
UPDATED:
Dave, sorry about the confusion. It is not PHP 6 that is at issue with my server but MySQL. I am now using 5.5.20 and it is highly recommended that we use mysqli_* instead.
I know that you haven't got that integrated into CMSB as yet and I will continue with mysql_* but I just wanted to clarify that it was the MySQL upgrade and not PHP.
Thanks
Terry
Dave, sorry about the confusion. It is not PHP 6 that is at issue with my server but MySQL. I am now using 5.5.20 and it is highly recommended that we use mysqli_* instead.
I know that you haven't got that integrated into CMSB as yet and I will continue with mysql_* but I just wanted to clarify that it was the MySQL upgrade and not PHP.
Thanks
Terry