PnD Posted April 12, 2021 Share Posted April 12, 2021 Dear all, Currently, I am running a _EzMySql_GetTable2d function below $result = _EzMySql_GetTable2d("select externalID,locationName,street1,city from orders where Id ='1113602'") _ArrayDisplay($result) and this is what I got My question is that how would I able to assign the results above to the following variables Local $Ref = the result from Col 0, Row1 Local $Euname = the result from Col 1, Row1 Local $street = the result from Col 2, Row1 Local $city = the result from Col3, Row1 Your help is greatly appreciated! Thank you. Link to comment Share on other sites More sharing options...
pixelsearch Posted April 12, 2021 Share Posted April 12, 2021 Hi PnD, I would go on something like this : $result = _EzMySql_GetTable2d("select externalID,locationName,street1,city from orders where Id ='1113602'") Local $iRet = _ArrayDisplay($result) If $iRet And Ubound($result) > 1 Then Local $Ref = $result[1][0] Local $Euname = $result[1][1] Local $street = $result[1][2] Local $city = $result[1][3] EndIf Maybe also check the Array got 2 dimensions and 4 columns (in case you won't always use _ArrayDisplay) PnD 1 Link to comment Share on other sites More sharing options...
Nine Posted April 13, 2021 Share Posted April 13, 2021 But the real question is why do you need to assign array result to simple variables ? I do not think it is necessary as you can access to individual cell by specifying its indexes. Make sure you understand arrays before spending lots of time creating variables uselessly. PnD 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
mLipok Posted April 13, 2021 Share Posted April 13, 2021 (edited) @PnD to forum. Why to assign variables at all ? Did you found what Enum are for ? _Example() Func _Example() Local Enum _ $_COMMONNAME_C0_externalID, _ $_COMMONNAME_C1_locationName, _ $_COMMONNAME_C2_steet1, _ $_COMMONNAME_C3_city, _ $_COMMONNAME_MAX Local $a_Locations = _EzMySql_GetTable2d("select externalID,locationName,street1,city from orders where Id ='1113602'") _ArrayDisplay($a_Locations) For $i_row_idx =1 To UBound($a_Locations) -1 If StringInStr($a_Locations[$i_row_idx][$_COMMONNAME_C1_locationName], 'Christopher') Then ConsoleWrite($a_Locations[$i_row_idx][$_COMMONNAME_C0_externalID] & @CRLF) ConsoleWrite($a_Locations[$i_row_idx][$_COMMONNAME_C1_locationName] & @CRLF) ConsoleWrite($a_Locations[$i_row_idx][$_COMMONNAME_C2_steet1] & @CRLF) ConsoleWrite($a_Locations[$i_row_idx][$_COMMONNAME_C3_city] & @CRLF) EndIf Next EndFunc Edited April 13, 2021 by mLipok PnD 1 Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
PnD Posted April 13, 2021 Author Share Posted April 13, 2021 Hi PixelSearch, Nine and MLipok, Thank you so much for your quick reply and provided solutions. The reason that I choose to assign the results to variables so that I can parse those variable to matched fields on a html file so later I can print that html out (such as Label which has Eu's name, address and so on) From mLipok's solution, i have modify it to be Local Enum _ $_COMMONNAME_C0_externalID, _ $_COMMONNAME_C1_locationName, _ $_COMMONNAME_C2_steet1, _ $_COMMONNAME_C3_city, _ $_COMMONNAME_MAX Local $a_Locations = _EzMySql_GetTable2d("select externalID,locationName,street1,city from orders where Id ='1113602'") _ArrayDisplay($a_Locations) For $i_row_idx =1 To UBound($a_Locations) -1 local $Ref= ($a_Locations[$i_row_idx][$_COMMONNAME_C0_externalID]) local $Euname=($a_Locations[$i_row_idx][$_COMMONNAME_C1_locationName]) local $street= ($a_Locations[$i_row_idx][$_COMMONNAME_C2_steet1]) local $city= ($a_Locations[$i_row_idx][$_COMMONNAME_C3_city]) Next MsgBox($MB_SYSTEMMODAL, "Here we go", $Ref& @CRLF & $Euname &@CRLF & $street & @CRLF & $city) and it works great! From PixelSearch's solution, it also works perfectly as well If $iRet And Ubound($result) > 1 Then Local $Ref = $result[1][0] Local $Euname = $result[1][1] Local $street = $result[1][2] Local $city = $result[1][3] EndIf MsgBox($MB_SYSTEMMODAL, "Here we go", $Ref& @CRLF & $Euname &@CRLF & $street & @CRLF & $city) Nine is absolutely right. I do not have to assign the value to a variable. Instead, just simply parse $result[1][0], and so on to any field I want to replace in that html file. However, is it helpful and convenience just to assign Global variables to those values so that we can use those variables for others functions instead of just using $result[1][0], and so on without knowing unique names? I also have a follow up question since it involves array. Would you please recommend any solutions to shorten the codes below to make it works faster (I have to filedelete first because filewire only append write) Local $html = FileRead(@ScriptDir & "\Ship LabelV2.html") Local $new_html = StringReplace($html,"EUNAME#",$EUName) Local $new_html1= StringReplace($new_html,"#ITIorder#",$ITIOrder) Local $new_html2 = StringReplace($new_html1,"#Model#",$TVModel) Local $new_html3 = StringReplace ($new_html2,"#Ref#",$ITIRef) Local $new_html4 = StringReplace ($new_html3,"#Serial#",$Input1) Local $new_html5 = StringReplace ($new_html4,"#Sale#",$Input) FileDelete(@ScriptDir & "\Ship LabelV3.html") FileWrite(@ScriptDir & "\Ship LabelV3.html",$new_html5) Link to comment Share on other sites More sharing options...
mLipok Posted April 13, 2021 Share Posted April 13, 2021 @PnD please read: https://www.autoitscript.com/wiki/Forum_FAQ#How_can_I_edit_my_post_on_the_forum_.3F and: * How to post code on the forum * and modify your previous post accordingly. PnD 1 Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
mLipok Posted April 13, 2021 Share Posted April 13, 2021 (edited) as to your code Why do you use brackets in this part: Local $Ref= ($a_Locations[$i_row_idx][$_COMMONNAME_C0_externalID]) I mean instead such form: Local $Ref= $a_Locations[$i_row_idx][$_COMMONNAME_C0_externalID] ? Edited April 13, 2021 by mLipok PnD 1 Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
PnD Posted April 13, 2021 Author Share Posted April 13, 2021 Hi mLipok, Thank you for your instruction. I have just repost my quote here as I could not find any edit button from my previous response. If you have the admin right, please help me delete it. Hi PixelSearch, Nine and MLipok, Thank you so much for your quick reply and provided solutions. The reason that I choose to assign the results to variables so that I can parse those variable to matched fields on a html file so later I can print that html out (such as Label which has Eu's name, address and so on) From mLipok's solution, i have modify it to be Local Enum _ $_COMMONNAME_C0_externalID, _ $_COMMONNAME_C1_locationName, _ $_COMMONNAME_C2_steet1, _ $_COMMONNAME_C3_city, _ $_COMMONNAME_MAX Local $a_Locations = _EzMySql_GetTable2d("select externalID,locationName,street1,city from orders where Id ='1113602'") _ArrayDisplay($a_Locations) ; Bracket Removed as typo from previous post. For $i_row_idx =1 To UBound($a_Locations) -1 local $Ref= $a_Locations[$i_row_idx][$_COMMONNAME_C0_externalID] local $Euname=$a_Locations[$i_row_idx][$_COMMONNAME_C1_locationName] local $street= $a_Locations[$i_row_idx][$_COMMONNAME_C2_steet1] local $city= $a_Locations[$i_row_idx][$_COMMONNAME_C3_city] Next From PixelSearch's solution, it also works perfectly as well If $iRet And Ubound($result) > 1 Then Local $Ref = $result[1][0] Local $Euname = $result[1][1] Local $street = $result[1][2] Local $city = $result[1][3] EndIf MsgBox($MB_SYSTEMMODAL, "Here we go", $Ref& @CRLF & $Euname &@CRLF & $street & @CRLF & $city) Nine is absolutely right. I do not have to assign the value to a variable. Instead, just simply parse $result[1][0], and so on to any field I want to replace in that html file. However, is it helpful and convenience just to assign Global variables to those values so that we can use those variables for others functions instead of just using $result[1][0], and so on without knowing unique names? I also have a follow up question since it involves array. Would you please recommend any solutions to shorten the codes below to make it works faster (I have to filedelete first because filewire only append write) Local $html = FileRead(@ScriptDir & "\Ship LabelV2.html") Local $new_html = StringReplace($html,"EUNAME#",$EUName) Local $new_html1= StringReplace($new_html,"#ITIorder#",$ITIOrder) Local $new_html2 = StringReplace($new_html1,"#Model#",$TVModel) Local $new_html3 = StringReplace ($new_html2,"#Ref#",$ITIRef) Local $new_html4 = StringReplace ($new_html3,"#Serial#",$Input1) Local $new_html5 = StringReplace ($new_html4,"#Sale#",$Input) FileDelete(@ScriptDir & "\Ship LabelV3.html") FileWrite(@ScriptDir & "\Ship LabelV3.html",$new_html5) Link to comment Share on other sites More sharing options...
mLipok Posted April 13, 2021 Share Posted April 13, 2021 30 minutes ago, PnD said: Thank you for your instruction. I have just repost my quote here as I could not find any edit button from my previous response. If you have the admin right, please help me delete it. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
mLipok Posted April 13, 2021 Share Posted April 13, 2021 32 minutes ago, PnD said: Nine is absolutely right. I do not have to assign the value to a variable. Instead, just simply parse $result[1][0], and so on to any field I want to replace in that html file. However, is it helpful and convenience just to assign Global variables to those values so that we can use those variables for others functions instead of just using $result[1][0], and so on without knowing unique names? this is called MAGIC NUMBER PnD 1 Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
JockoDundee Posted April 13, 2021 Share Posted April 13, 2021 4 hours ago, mLipok said: Edit option shows up only when you have 5 or more posts. PnD 1 Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
PnD Posted April 13, 2021 Author Share Posted April 13, 2021 I see now. Thanks JockoDundee! Link to comment Share on other sites More sharing options...
JockoDundee Posted April 14, 2021 Share Posted April 14, 2021 On 4/12/2021 at 3:51 PM, PnD said: $result = _EzMySql_GetTable2d("select externalID,locationName,street1,city from orders where Id ='1113602'") _ArrayDisplay($result) and this is what I got Question, why are the column names returned in row 0? Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
PnD Posted April 18, 2021 Author Share Posted April 18, 2021 On 4/13/2021 at 6:05 PM, JockoDundee said: Question, why are the column names returned in row 0? I really have no idea. That's exactly what I got from the query's result. Link to comment Share on other sites More sharing options...
JockoDundee Posted April 18, 2021 Share Posted April 18, 2021 Whose UDF is this function from: _EzMySql_GetTable2d Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
PnD Posted April 18, 2021 Author Share Posted April 18, 2021 this is the au3 (see attachment) that I used EzMySql.au3 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now