Jump to content

mysql help


Recommended Posts

$QSID = 90620;this would normally be dynamic
$sql = _MySQLConnect("DataMiner", "", "DataMiner", "10.40.32.45")
;$var = _Query($sql, "SELECT * FROM patients WHERE patient_id = '0906200'")
$var = _Query($sql, """SELECT * FROM patients WHERE patient_id = '0" & $QSID & "0'""")

I have been having a problem with the _Query command. I need to make the query dynamic based on a patient identifier, $QSID. The code works if I uncomment line 2 and comment line 3 (thus making it a static query), however, I believe they say the same thing. is my formatting wrong? If I turn

$sql = _MySQLConnect("DataMiner", "", "DataMiner", "10.40.32.45")

;$var = _Query($sql, "SELECT * FROM patients WHERE patient_id = '0906200'")

$var = _Query($sql, """SELECT * FROM patients WHERE patient_id = '0" & $QSID & "0'""")

I did a test and made $query = """SELECT * FROM patients WHERE patient_id = '0" & $QSID & "0'"""

msgbox(0,"",$query)

and it appears to yield the same input data as line two. Any help would be greatly appreciated.

error consult:

mysql.au3 (48) : ==> The requested action with this object has failed.:

Return $oConnectionobj.execute ($sQuery)

Return $oConnectionobj.execute ($sQuery)^ ERROR

->13:52:34 AutoIT3.exe ended.rc:1

Link to comment
Share on other sites

Wouldn't it be : _Query("SELECT * FROM patients WHERE patient_id = '0" & $QSID & "0'")?

Wow I am a knuckle head. Thanks so much - I can't believe I've been banging my head against that for a half hour now. I don't know why I was thinking that the double quotes were needed. Thanks so much!!!

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