ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Sql400

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sql400

    Good morning,

    I hope I am in the right section.
    From my php I read a file from AS400 and the read data I have to write it to a new file in AS400.
    When I go to do the insert (again with php) the accented characters (first name and last name) give me problems.
    How can I insert the accented characters into my db400 as well?

    $sql_insert = “Insert into LIB.MyFILE.
    VALUES('Zurli', 'Joseph' )”

    'Zurli' is an example of an accented character.

    In general, if I need to update or insert accented characters into my db400 with sql, how do I insert or update accented characters.?

    Thanks

    Translated with DeepL.com (free version)​

  • #2
    Hi,

    Usually you should use SQL parameters instead putting them directly into the string.
    PHP should then do the correct stuff for you.

    $sql_insert = “Insert into LIB.MyFILE VALUES(?, ? )”;
    $stmt = db2_prepare($conn, $sql_insert);
    $value1 = "First name";
    $value2 = "Last name";
    db2_execute($stmt, [$value1, $value2]);

    Comment

    Working...
    X