Jump to content

MySQL and @computername


Recommended Posts

HI , im trying to do a simple query using mysql.udf

$pcnm=@computername

_Query($sql, "UPDATE games.keys SET lockedby='' where lockedby ="&$pcnm)

and i always get a unknown column 'lalala' where clause..... (lalala = computername) if a put numbers instead of chars its ok (the field is varchar)

Link to comment
Share on other sites

You didn't put quotation marks around computer name.

@ComputerName is a string, correct? Well (and this IS a MySQL thing btw) when you use a string in a MySQL query, you have to put quotation marks (single or double) around it. So, the query you want is something like this:

UPDATE games.keys SET lockedby = '' where lockedby = 'Unicron'
(Unicron is the name of my computer)

What you're sending now is:

UPDATE games.keys SET lockedby = '' where lockedby = Unicron

That's why if you use numbers it works fine, because numbers are not string, and thus don't need to be surrounded by quotes.

So in your AutoIt string, you want to do something like this:

$pcnm = @computername
_Query($sql, "UPDATE games.keys SET lockedby='' where lockedby = '" & $pcnm & "'")
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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