Guif0DA's Recent Forum Activity

  • Hey scidave, thanks for replying

    So, yes, I'm behind a router and have portforwarded the essencial ports already, what ports exacly should I forward? So I can check if there is something left..

    About the other stuffs he unfortunaly is sleeping right now so I will be able only to inform about this other questions tomorrow =(

    but the error was when he tryed to open the program, appeared a script error saying ''host 'his globalip' was unable to conect to this database" I'll send a pic of it tomorrow with more detailed informations..

    But I think it's nothing related to ports cuz times ago I had some private game servers with sql database running here for friends and they always connected..

    Maybe is something about the GRANT privileges? I've readed something about it but not sure if could be it, it seems to allow accounts privileges, but they are connecting with the root username, should then I make a new account with some privileges just for remote access?

  • Hey Scidave or any other

    I'm with a new problem here..

    I've made a simple construct game with some of those scripts so my friend could test if he can access my database and add/read from it...

    I've changed MySQLdb.connect in inital script to:

    db = MySQLdb.connect("MY GLOBAL IP","root","","highscores" )

    and I compiled everything selecting the pyc files.

    When he tries to test the game, appear an error where it says "host 'his global ip' is not allowedto connect to this MySQL server"

    so probably i had to change something to allow remote access to my db.. so I looked for help in google and found that i need to add in my.cnf

    bind-address=my_ip and add a comment to skip-networking.

    I'm using XAMPP so i've found this file at the mysql folder and the skip-networking was already commented and I added the bind-address=my_localip

    but he still had the same error.. so probably it not worked or I'm doing something wrong.. any1 know what it should be??

    thanks..

  • Should be possible a custom editbox with this plugin?

    like you can write stuffs with CAPITAL on or off, use Shift to make symbols, etc.. if so.. can u help me figure it out? ty

    edit: made it already ;D

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • OMG Thank you!!!!! I'm gonna try this!

    Edit: Wowww it really worked! Can't thank you enough for this... I was getting crazy making this to work..

    once more, thanks!

    I'm trying to read from the DB with this script, not getting any error, just doesn't showing nothing:

    maxprice = 1000
    
    cursor.execute("""SELECT FIRST_NAME FROM TEST
              WHERE INCOME > %s""", (maxprice))
    
    results = cursor.fetchone()
    EditBox3.AppendText(results)[/code:yd0jhkoc]
    Do you know what might be the problem?
    
    EDIT2: Ok, I fixed I guess.. 
    changed EditBox3.AppendText(results) to EditBox3.AppendText(str(results))    
    I think this topic serves as a tutorial too.. xD
  • Did you also try setting the EditBox.Text to python variables with the new way?

    name1 = EditBox.Text

    name2 = EditBox2.Text

    Then replace those names in the execute call.

    Then if that fails, try it without the single quotes around the %s....

    If none of those work, I'll download/install the library and see what's up.

    Ya I had already tryed those too and now tryed without the quotes around %s but don't worked too..

    If you could download them I would greatly appreciate your effort.. I'm getting crazy trying to make this work

  • Try this:

    > 
    sql = """INSERT INTO TEST(FIRST_NAME,
             LAST_NAME, AGE, SEX, INCOME)
             VALUES ('%s', '%s', 20, 'M', 2000)"""
    
    try:
    
    cursor.execute(sql,EditBox.Text,EditBox2.Text)
    db.commit()
    except:
    db.rollback()
    
    [/code:30en8u9a]
    
    If that doesn't work you can try changing the cursor execute line to this (notice the commas):
    cursor.execute(sql,(EditBox.Text,),(EditBox2.Text,))
    

    I've tryed both ways with and without commas but none worked.. =(

    any more ideas?

  • Now I've tryed add

    name = str(EditBox.Text) before sql instruction and change:

    sql = """INSERT INTO TEST(FIRST_NAME,
             LAST_NAME, AGE, SEX, INCOME)
             VALUES (EditBox.Text, EditBox2.Text, 20, 'M', 2000)"""[/code:1mua2ebh]
    
    to:
    [code:1mua2ebh]sql = """INSERT INTO TEST(FIRST_NAME,
             LAST_NAME, AGE, SEX, INCOME)
             VALUES (name, 'test', 20, 'M', 2000)"""[/code:1mua2ebh]
    
    but still nothing.. doesn't add nothing to the database, It's like the script can't read the text from editbox.. 
    If I change VALUES (name, 'test', 20, 'M', 2000) to VALUES ('nametest', 'test', 20, 'M', 2000) then it works.. but I need to make it add what is written in the editboxes..
  • Thanks a lot

  • Yea i managed to make the musics play again, it wasn't nothing related from construct.. it's all fine now

  • Just add a window object and use the action maximize

  • scidave

    hey dude, do u know why python can't get the info from EditBox.Text ?

    the '.Text' is appearing in red at the right bar.. is that okay? What means the red color?

    i'm trying this:

    import MySQLdb
    
    db = MySQLdb.connect("localhost","root","","TESTING" )
    
    cursor = db.cursor()
    
    sql = """INSERT INTO TEST(FIRST_NAME,
             LAST_NAME, AGE, SEX, INCOME)
             VALUES (EditBox.Text, EditBox2.Text, 20, 'M', 2000)"""
    
    try:
    
     cursor.execute(sql)
     db.commit()
    except:
     db.rollback()[/code:kxdkm6nk]
  • Either way works fine...I've done both. As long as your version of Python is 2.6..it isn't a problem to replace the current files with the ones you copy (but it is not necessary..just select "no" to overwriting existing files.

    thanks a lot for helping

    I will see if now I can access SQL databases

Guif0DA's avatar

Guif0DA

Member since 5 Dec, 2010

None one is following Guif0DA yet!

Trophy Case

  • 13-Year Club
  • Email Verified

Progress

14/44
How to earn trophies