Jump to content

Recommended Posts

Hello, its my first time experimenting with databases.

First Im trying to understand and see how works everything so i just copy and paste the example of the UDP. But i cant even start because i got error not connecting to the database.

These are the real values of the database no matters if someone login, are from a test account in a website. Later i can delete it and create a new one.

image.png.ada51513d78aabd9464064f504dacbb6.png

here database name:

image.thumb.png.6679810bddc1353b3fcccd0d29b1edec.png

 

.au3

#include "EzMySql.au3"
#include <Array.au3>

If Not _EzMySql_Startup() Then
    MsgBox(0, "Error Starting MySql", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
    Exit
EndIf

$Pass = "0WJdeYpC0L"

If Not _EzMySql_Open("sql111.epizy.com", "epiz_24918214", $Pass, "epiz_24918214_82", "3306") Then
    MsgBox(0, "Error opening Database", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
    Exit
EndIf

If Not _EzMySql_Exec("CREATE DATABASE IF NOT EXISTS epiz_24918214_82") Then
    MsgBox(0, "Error opening Database", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
    Exit
EndIf

If Not _EzMySql_SelectDB("epiz_24918214_82") Then
    MsgBox(0, "Error setting Database to use", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
    Exit
EndIf

$sMySqlStatement = "CREATE TABLE IF NOT EXISTS TestTable (" & _
                   "RowID INT NOT NULL AUTO_INCREMENT," & _
                   "Name TEXT NOT NULL ," & _
                   "Age INT NOT NULL ," & _
                   "EyeColour TEXT NOT NULL ," & _
                   "HairColour TEXT NOT NULL ," & _
                   "PRIMARY KEY (`RowID`) ," & _
                   "UNIQUE INDEX RowID_UNIQUE (`RowID` ASC) );"

If Not _EzMySql_Exec($sMySqlStatement) Then
    MsgBox(0, "Error Creating Database Table", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
    Exit
EndIf

Local $aEyeColours[7] = ["Amber","Blue","Brown","Grey","Green","Hazel","Red"]
Local $aHairColours[6] = ["Brown","Black","Blond","Grey","Green","Pink"]

Local $sMySqlStatement = ""
For $i = 1 To 50 Step 1
    $sMySqlStatement &= "INSERT INTO TestTable (Name,Age,EyeColour,HairColour) VALUES (" & _
                        "'Person" & $i & "'," & _
                        "'" & Random(1, 100, 1) & "'," & _
                        "'" & $aEyeColours[Random(0, 6, 1)] & "'," & _
                        "'" & $aHairColours[Random(0, 5, 1)] & "');"
Next

If Not _EzMySql_Exec($sMySqlStatement) Then
    MsgBox(0, "Error inserting data to Table", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
    Exit
EndIf

MsgBox(0, "Last AUTO_INCREMENT columnID2", _EzMySql_InsertID())

$aOk = _EzMySql_GetTable2d("SELECT Name,EyeColour FROM TestTable WHERE EyeColour = '"& $aEyeColours[Random(0, 6, 1)] & "';")
$error = @error
If Not IsArray($aOk) Then MsgBox(0, $sMySqlStatement & " error", $error)
_ArrayDisplay($aOk, "2d Array Names of certain eyecolour")

MsgBox(0, "", "Following is how to get a row at a time of a query as a 1d array")
If Not _EzMYSql_Query("SELECT * FROM TestTable WHERE HairColour = '"& $aHairColours[Random(0, 5, 1)] & "' LIMIT 5;") Then
MsgBox(0, "Query Error", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg())
    Exit
EndIf

For $i = 1 To _EzMySql_Rows() Step 1
    $a1Row = _EzMySql_FetchData()
    _ArrayDisplay($a1Row, "Result: " & $i)
Next

_EzMySql_Exec("DROP TABLE TestTable")

_EzMySql_Close()
_EzMySql_ShutDown()
Exit

Btw i think there are some other dll or something like that. Im not sure if i have the correct. I just downloaded everything.

 

image.png.de2a6246399ba955c7ae3eca633f921f.pngimage.png.79166d49359309b8cad6c527011f49b9.png

Link to post
Share on other sites

sql111.epizy.com has an unroutable DNS address (192.168.0.161).  So there is no way to test it externally using the DNS name. 

Why would you publish an unroutable IP address on a public name server?

image.png.368d8d326b65d713e8a05e80d9100c96.png

Edited by TheXman
Link to post
Share on other sites
32 minutes ago, TheXman said:

sql111.epizy.com has an unroutable DNS address (192.168.0.161).  So there is no way to test it externally. 

Why would you publish an unroutable IP address on a public name server?

image.png.368d8d326b65d713e8a05e80d9100c96.png

I dont know bro, im new on this.

 

image.png.e75e8dff330ff0baa4a66587d6fae590.png

Link to post
Share on other sites
31 minutes ago, rednaxela said:

I dont know bro, im new on this.

You said that you were new to databases, not networking.  In any case, at this point, your issue is not related to AutoIt.  Bro!

 

 

 

 

Link to post
Share on other sites
Just now, TheXman said:

You said that you were new to databases, not networking.  In any case, at this point, your issue is not related to AutoIt.  Bro!

 

 

 

 

well my first time trying to connect to mysql and see if i can get some values from there.

any experience even with php

Link to post
Share on other sites

MySQL databases created on free web hosting sites (like epizy.com) are usually for internal access by web sites that you host on their servers like bulletin boards or web sites with dynamic content.  They usually do not allow general access from external connections.  Epizy may be different but I doubt it.  I'm sure they have FAQ's or a knowledgebase for you to read more about it.  Good luck!

 

** Update  **

As I thought, this link came from the epizy knowledgebase:

https://support.infinityfree.net/mysql/connecting-to-mysql-from-elsewhere/

Edited by TheXman
Link to post
Share on other sites
30 minutes ago, TheXman said:

MySQL databases created on free web hosting sites (like epizy.com) are usually for internal access by web sites that you host on their servers like bulletin boards or web sites with dynamic content.  They usually do not allow general access from external connections.  Epizy may be different but I doubt it.  I'm sure they have FAQ's or a knowledgebase for you to read more about it.  Good luck!

 

** Update  **

As I thought, this link came from the epizy knowledgebase:

https://support.infinityfree.net/mysql/connecting-to-mysql-from-elsewhere/

Its good to know about that. Well i will need research more there say its possible with php scripts or buying the premiun 3 usd.

Link to post
Share on other sites
On 2/19/2021 at 6:08 PM, TheXman said:

MySQL databases created on free web hosting sites (like epizy.com) are usually for internal access by web sites that you host on their servers like bulletin boards or web sites with dynamic content.  They usually do not allow general access from external connections.  Epizy may be different but I doubt it.  I'm sure they have FAQ's or a knowledgebase for you to read more about it.  Good luck!

 

** Update  **

As I thought, this link came from the epizy knowledgebase:

https://support.infinityfree.net/mysql/connecting-to-mysql-from-elsewhere/

Hey bro, which provider can give me this access? I will buy it!! I already tested with others and can not connect.

Link to post
Share on other sites

Start with SQLite (https://www.autoitscript.com/autoit3/docs/libfunctions/_SQLite_Query.htm) and then migrate to bigger DBs. You first need to understand SQL, and then the web interface. The problem in the first post is a connection issue, nothing to do with actual SQL. 

SELECT myproblem FROM tblproblem ORDER BY 1 DESC; :)

 

PS, you will need to download SQLite separately. 

 

 

Skysnake

Why is the snake in the sky?

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...