Sign in to follow this  
Followers 0
nht3004

How can I connect to database?

12 posts in this topic

How can I connect to the online databases (SQL and PHPAdmin I meant)

For example, I want to get data from online table `userID` `userPass` in `userDataBase` at www.somehost.something.anything, what should I do

I have thought about the way to use PHP to create the HTML Source "True" or "False", for instance, www.somehost.com/login.php?id=nht3004&password=nht3004 will return "True" if the log in information is true and "False" otherwise. But in that way, my program is TOO VULNERABLE!

Help me plz ^_^


for(loop=0; loop<infinity; loop++) { alert('I love you'); }

Share this post


Link to post
Share on other sites



How can I connect to the online databases (SQL and PHPAdmin I meant)

For example, I want to get data from online table `userID` `userPass` in `userDataBase` at www.somehost.something.anything, what should I do

I have thought about the way to use PHP to create the HTML Source "True" or "False", for instance, www.somehost.com/login.php?id=nht3004&password=nht3004 will return "True" if the log in information is true and "False" otherwise. But in that way, my program is TOO VULNERABLE!

Help me plz ^_^

Have you searched the forum yet?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Have you searched the forum yet?

Yes but a lot of topics ^_^ , I don't know which satisfies my request ;)

And many of them I can't use, example

$sql = _MySQLConnect("root", "", "database_name", "localhost") ;CHANGE LOGIN LOCATION and credentials
    If NOT @error Then                       
        $query = ("Select * FROM database_name ;");blah blah blah sql statement
        $result = $sql.execute($query)
        If NOT @error Then
            FileWrite($file, $query) ;write it to a file and do whatever else you need to do with it
        EndIf
        _MySQLEnd($sql) 
    EndIf
Edited by nht3004

for(loop=0; loop<infinity; loop++) { alert('I love you'); }

Share this post


Link to post
Share on other sites

then you are doing it wrong. How you are doing it wrong is anyone's guess. We would need to see your code to see what you are doing wrong.

Here is my code:

#include <_sql.au3>;
$sql=_SQL_Connect(-1, "localhost","SM", "root", "vertrigo")
$result=_SQL_Execute(-1,"Select * FROM SM ");
MsgBox($result);
_SQL_End($sql);

An _sql.au3 I get from http://www.autoitscript.com/forum/index.ph...;hl=SQL+connect

It prompts an error of _sql.au3 function!


for(loop=0; loop<infinity; loop++) { alert('I love you'); }

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Your not even using it right.

#include <_sql.au3>;
#include <Array.au3>

_SQL_Startup()
_SQL_RegisterErrorHandler()

If _SQL_Connect(-1, "localhost","SM", "root", "vertrigo") = $SQL_ERROR then Msgbox(0 + 16 +262144,"Error",_SQL_GetErrMsg())

Local $aResult,$iRows,$iColumns
_SQL_GetTable2D(-1,"Select * FROM SM",$aResult,$iRows,$iColumns);
If @error then 
    Msgbox(0,"",_SQL_GetErrMsg())
Else
    _ArrayDisplay($aResult)
EndIf

_SQL_Close()
Edited by ChrisL

Share this post


Link to post
Share on other sites

#10 ·  Posted

Your not even using it right.

#include <_sql.au3>;
#include <Array.au3>

_SQL_Startup()
_SQL_RegisterErrorHandler()

If _SQL_Connect(-1, "localhost","SM", "root", "vertrigo") = $SQL_ERROR then Msgbox(0 + 16 +262144,"Error",_SQL_GetErrMsg())

Local $aResult,$iRows,$iColumns
_SQL_GetTable2D(-1,"Select * FROM SM",$aResult,$iRows,$iColumns);
If @error then 
    Msgbox(0,"",_SQL_GetErrMsg())
Else
    _ArrayDisplay($aResult)
EndIf

_SQL_Close()
I still stuck, boohoo, it always shows that "Query Error" and "Connection Error" even I check the syntax right in PHP T.T, fix this for me!

My database : SM

Username : root

Password: Vertrigo

Host: Localhost


for(loop=0; loop<infinity; loop++) { alert('I love you'); }

Share this post


Link to post
Share on other sites

#11 ·  Posted

Share this post


Link to post
Share on other sites

#12 ·  Posted

Something else your database is called SM and your doing a select from a table called SM.

Is that correct, you have a table called SM inside a database also called SM?

Can you post the php code that you say works ok?

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