Jump to content

[Help] Mysql Charset


djharbi2

Recommended Posts

Hi, saving datebase. But does not record the question properly


entered: your favorite writer?
saved: your favorite writer'

(? instead  '  is happening)

database charset: utf-8

how can I solve this problem?

local username = "root"
local password = "123456"
local b_data = dbConnect("mysql","dbname=mtaserver;host=localhost;charset=utf8;port=3311", username, password, "autoreconnect=1"),

local b_username = "admin"
local b_pass = "1234"
local b_ques = "your favorite writer?"
local b_answ = "T. Well"
local b_money = "0"

local bank = dbExec(b_data, "INSERT INTO bank (bank_username,bank_pass,bank_ques,bank_answ,bank_money) VALUES('"..b_username.."','"..b_pass.."','"..b_ques.."','"..b_answ.."','"..b_money.."')")

 

Edited by djharbi2
Link to comment
  • Moderators
1 hour ago, djharbi2 said:

Does anyone know the problem?

 

Try, like this:

dbExec(b_data, "INSERT INTO bank (bank_username,bank_pass,bank_ques,bank_answ,bank_money) VALUES (?,?,?,?,?)", b_username, b_pass, b_ques, b_answ, b_money)

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...