This topic is locked

Database wrappers

12/20/2016 10:35:02 PM
PHPRunner General questions
H
headingwest author

Hi, where can I find a list of database wrappers that are available for PHP Runner MySQL statements? To remove quotes/apostrophes etc.

admin 12/22/2016

You need to explain what exactly you trying to achieve or what kind of problem you trying to solve. This question doesn't make much sense in the way it is asked.

H
headingwest author 12/22/2016



You need to explain what exactly you trying to achieve or what kind of problem you trying to solve.


If I want to insert using CustomQuery($sql) and I want to check that the $sql is OK to insert into a table. MySQL varchar or mediumtext.
In this situation I select an Email template from the database that includes words like don't, won't, can't plus html formatting and then insert into another table.
I want to check that the $sql insert is OK. Are there built in functions in PHPRunner??
so...

select htmlmessagefield from table a

insert htmlmessagefield into table b (crashes from misplaced quotes etc)

kujox 12/24/2016



If I want to insert using CustomQuery($sql) and I want to check that the $sql is OK to insert into a table. MySQL varchar or mediumtext.
In this situation I select an Email template from the database that includes words like don't, won't, can't plus html formatting and then insert into another table.
I want to check that the $sql insert is OK. Are there built in functions in PHPRunner??
so...

select htmlmessagefield from table a

insert htmlmessagefield into table b (crashes from misplaced quotes etc)


Do you mean you want to escape the words that contain apotheoses like "won't" etc, if you do then you can escape the characters, not sure if there's a phprunner function for this, no doubt there will be but you could use the command mysqli_real_escape_string()

kujox 12/24/2016



If I want to insert using CustomQuery($sql) and I want to check that the $sql is OK to insert into a table. MySQL varchar or mediumtext.
In this situation I select an Email template from the database that includes words like don't, won't, can't plus html formatting and then insert into another table.
I want to check that the $sql insert is OK. Are there built in functions in PHPRunner??
so...

select htmlmessagefield from table a

insert htmlmessagefield into table b (crashes from misplaced quotes etc)


Do you mean you want to escape the words that contain apotheoses like "won't" etc, if you do then you can escape the characters, not sure if there's a phprunner function for this, no doubt there will be but you could use the command mysqli_real_escape_string()

admin 12/24/2016

If your database is MySQL you can use mysqli_real_escape_string() or PHPRunner's addSlashes() which does the same thing.

H
headingwest author 12/26/2016



If your database is MySQL you can use mysqli_real_escape_string() or PHPRunner's addSlashes() which does the same thing.


Thanks Sergey is addSlashes() exactly the same as mysqli_real_escape_string()??

admin 12/27/2016

No, it is not exactly the same thing but they do the same job. addSlashes() also need to ensure that we use mysqli_ extension and utilize something else if it is not. You can use either function.