Sign in to follow this  
Followers 0
radienergos

MySQL and @computername

3 posts in this topic

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)

Share this post


Link to post
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 & "'")

Share this post


Link to post
Share on other sites

thanks for the reply

i tried that but it didn't work

after a lot of tries :P and various combinations , i did it

$pcnm=@computername

$pcnm="'"&$pcnm&"'"

Share this post


Link to post
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
Sign in to follow this  
Followers 0