Sign in to follow this  
Followers 0
madmorgan

help with app to add data to mysql database

8 posts in this topic

hello all,

i have read other forms on here and i have downloaded and installed mysql on my server and i host off it as well so it all works i had also download the mysql.au3 file as well i get no coding errors but i want to add data to my database and i cant. the script runs but no data loads on to the deata base.

i and running this in the web server were the data base is installed.

please help me thanks.

#include "MySQL.au3"

$UserName = "root"
$Password = ""
$Database = "shop"
$MySQLServerName = "localhost"

$SQLInstance = _MySQLConnect($UserName,$Password,$Database,$MySQLServerName)


Dim $ColumnNames[11]
$ColumnNames[0]= "id"
$ColumnNames[1]= "CATS"
$ColumnNames[2]= "CATS2"
$ColumnNames[3]= "TITLE"
$ColumnNames[4]= "DECRYPTION"
$ColumnNames[5]= "PRICE"
$ColumnNames[6]= "SHIPPING"
$ColumnNames[7]= "ARGOS"
$ColumnNames[8]= "IMAGE"
$ColumnNames[9]= "DATE"
$ColumnNames[10]= ""
MsgBox(0, "", $ColumnNames[5])
Dim $shopitem[11]
$shopitem[0]= ""
$shopitem[1]= "Audio"
$shopitem[2]= "Audio"
$shopitem[3]= "test"
$shopitem[4]= "test"
$shopitem[5]= "10.00"
$shopitem[6]= "10.00"
$shopitem[7]= "test"
$shopitem[8]= "test"
$shopitem[9]= "test"
$shopitem[10]= ""
MsgBox(0, "",$shopitem[2])
_AddRecord($SQLInstance,"goods",$ColumnNames,$shopitem)


_MySQLEnd($SQLInstance)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

I don't know which version of MySQL.au3 you use, so I can't give you much help.

I just downloaded ProgAndy's UDF from here but it's clearly not what you're using.

Anyway, can you really pass arrays the way you do? Are you sure you got your syntax right?

_AddRecord($SQLInstance,"goods",$ColumnNames,$shopitem)

EDIT: this was the right syntax, but it looks like this UDF has problems. See my other post below.

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Add error checking into your script:

After each MySql function call test @error and return value and you will see where is the problem.

If MySql UDF uses COM then also add COM error handler to your script to see the detailed error description.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

OK I got it: I found where you got this MySQL UDF. I bet it's there.

This thing needs an ODBC driver. Did you install it?

I didn't see any discussion about this specific UDF on this board: you'll find mostly the UDF of ProgAndy being referred to here. But since the UDFs use the same name it's a bit difficult to be sure. Have you noticed that there is a "support chat" on the web page from where you downloaded this stuff? Maybe you should ask questions there about this UDF, you're more likely to get informative answers.

EDIT: the author (cdkid) doesn't maintain it any longer. In your place I'd switch to ProgAndy UDF.

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

yea thats the site i got my info from but i will try the new udf file you posted and ill get back to you all if it works

Share this post


Link to post
Share on other sites

hello once again.

i have download the new udf files from the zip folder and placed tehm into the autoit include folder.

so now can some one please help me to recode my script so i can add data plz as i want to attach a gui to it latter but i reaily wan to keep it simple for now.

Share this post


Link to post
Share on other sites

You've reach the edge of my knowledge on this stuff. I'm using SQLite (a completely separate UDF and interface), Pervasive bases through a wrapper I wrote and a couple of other ODBC "pseudo-bases". To get on track using ProgAndy UDF, you should try the examples given and read the thread in the Example Scripts where I beleive you can find answer to common questions. Many users can help you there much more than I can do right now.

Best of luck


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

this is my over all goal to have a simple gui that collects the information from the user and adds it to the database so i need help getting the sql part done i did download that new file that was posted but i cart work it out so if some one can admeand my script for the sql part i would be grate full and her is the gui part of the program.

#include "MySQL.au3"


#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 509, 339, 192, 124)
$Label1 = GUICtrlCreateLabel("Title", 56, 56, 24, 17)
$Label2 = GUICtrlCreateLabel("Price", 48, 80, 28, 17)
$Label3 = GUICtrlCreateLabel("Shipping", 32, 112, 45, 17)
$Label4 = GUICtrlCreateLabel("Argos URL", 24, 152, 56, 17)
$Label5 = GUICtrlCreateLabel("Image", 264, 48, 33, 17)
$Label6 = GUICtrlCreateLabel("Date", 48, 192, 27, 17)
$Label7 = GUICtrlCreateLabel("Decuraption", 304, 112, 62, 17)
$Input1 = GUICtrlCreateInput("Input1", 88, 48, 153, 21)
$Input2 = GUICtrlCreateInput("Input2", 88, 80, 105, 21)
$Input3 = GUICtrlCreateInput("Input3", 88, 112, 121, 21)
$Input4 = GUICtrlCreateInput("Input4", 88, 152, 121, 21)
$Input5 = GUICtrlCreateInput("Input5", 88, 192, 121, 21)
$Input6 = GUICtrlCreateInput("Input6", 312, 48, 121, 21)
$Button1 = GUICtrlCreateButton("Browse", 320, 72, 75, 25)
$Edit1 = GUICtrlCreateEdit("", 256, 136, 185, 97)
GUICtrlSetData(-1, "Edit1")
$Button2 = GUICtrlCreateButton("Add Data", 208, 280, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $button2
            
            RUN SQL DATA
            
                
            
            

    EndSwitch
WEnd

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