2

I have a problem in my query. I retrieve the data using sqlsrv_query to move the data from Microsoft SQL 2008 to my mySQL server. The result of my query below:

enter image description here

I want to save the data in my MYSQL without any error in apostrophe. I tried to execute print_r() function but it does not work. I want to show them through foreach but it does not work. Do you have any idea?

matteo rulli
  • 1,413
  • 1
  • 18
  • 29
Kuya A
  • 343
  • 1
  • 17
  • 3
    print_r() doesn't save data to a database; String data should be escaped before storing to a database to prevent quotes from breaking the SQL query.... or you should be using bind variables with your SQL queries – Mark Baker Jul 12 '15 at 20:27

1 Answers1

0

Escape it as follows

public 'sample' => string 'SHAKEY\'S0002' (length=12)

Refer to this entry for more details

Community
  • 1
  • 1
Rohit Gupta
  • 2,559
  • 11
  • 23
  • 36