Jump to content

DebugString sais 'Error!'


FSXTim

Recommended Posts

Hello,

I have a small problem.

The DebugString sais 'Error!' (line 4), but why?

function MySQL_GetString(tableN, feldN, bedingung) 
    local result = mysql_query(sqlcon, "SELECT "..tableN.." from "..feldN.." WHERE "..bedingung) 
    if (not result) then 
         outputDebugString("Error!") 
    else 
        if(mysql_num_rows(result) > 0) then 
            local ds = mysql_fetch_assoc(result) 
            local savename = feldname 
            mysql_free_result(result) 
            return ds[feldname] 
        else 
            mysql_free_result(result) 
            return false 
        end 
    end 
end 

Greets

Link to comment

Thanks for your answer.

Here i definied sqlcon:

host = "XX" 
user = "XX" 
pass = "XX" 
db = "XX" 
port = 3306 
  
sqlcon = mysql_connect(host, user, pass, db, port) 

Just for example, here is a script, which is working perfectly with the mysql_query and sqlcon:

function playerLogin ( username,password,email ) 
    local result = mysql_query(sqlcon,"SELECT * FROM user_data WHERE Username='"..mysql_escape_string( sqlcon, username ).."';") 
    if result then 
        rows = mysql_num_rows(result) 
        if rows == 1 then 
            row = mysql_fetch_row(result) 
        end 
        mysql_free_result(result) 
    end 
end 

Greets

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...