Jump to content
Sign in to follow this  

MySQL query

Recommended Posts


I`m using this peiece of code I have found here on the forums. I have a problem trying to get these queries into only one, because I`m getting "out of syn`c" error message when I`m trying to run it.

Any ideas?

#include <array.au3>
#include "mysql.au3"

If @error Then Exit MsgBox(0, '', "")
$MysqlConn = _MySQL_Init()

$connected = _MySQL_Real_Connect($MysqlConn, "www.test.com", "DBusername", "DBpassword", "database")
If $connected = 0 Then Exit MsgBox(16, 'Connection Error', _MySQL_Error($MysqlConn))

$uname = 'testuser2'
$email = 'testuser2@test.com'
;"SELECT userid FROM profiles WHERE userid=(SELECT userid FROM users WHERE username=username)"
$uid = "SELECT userid FROM user WHERE username='" & _MySQL_Real_Escape_String($MysqlConn,$uname) &"'"
$substatus = "SELECT * FROM subscriptionlog  WHERE userid='" & _MySQL_Real_Escape_String($MysqlConn,$uid) & "' AND status='" & _MySQL_Real_Escape_String($MysqlConn,"1") & "'"
$query = "SELECT * FROM user WHERE username='"  & _MySQL_Real_Escape_String($MysqlConn,$uname) & "' AND email='" & _MySQL_Real_Escape_String($MysqlConn,$email) & "' AND status ='" & _MySQL_Real_Escape_String($MysqlConn,$substatus) & "'"
;$query = "SELECT * FROM user WHERE username='"  & _MySQL_Real_Escape_String($MysqlConn,$uid) & "' AND email='" & _MySQL_Real_Escape_String($MysqlConn,$email) 
MsgBox(0, '', $uid)
If _MySQL_Real_Query($MysqlConn, $uid) = $MYSQL_ERROR Then
    MsgBox(0, 'Error', _MySQL_Error($MysqlConn))
If _MySQL_Real_Query($MysqlConn, $substatus) = $MYSQL_ERROR Then
    MsgBox(0, 'Error', _MySQL_Error($MysqlConn))
If _MySQL_Real_Query($MysqlConn, $query) = $MYSQL_ERROR Then
    MsgBox(0, 'Error', _MySQL_Error($MysqlConn))



$res = _MySQL_Store_Result($MysqlConn)
$users = _MySQL_Num_Rows($res)
if $users == 1 then
MsgBox(0, '', "Account Found Login OK!")
   MsgBox(0,'',"Login Failed Either your ID and PW is wrong or your subscription has expired.");what to do if the UN and PW is not found

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.