从while循环获取一些记录到数组,然后通过电子邮件发送这些记录(Get some records from a while loop to an array, then send these records in an email)
我有一个
while
循环:$users = mysqli_query($con, "SELECT * FROM table"); while($row = mysqli_fetch_array($users)) { if ($row['column1'] != $row['column2']) { echo "There is a different between column1 and column2<br />"; } }
我想得到
column1
与column2
不同的所有记录,并将这些值放入电子邮件中。电子邮件看起来像这样:
ID Column1 Column2 1 111 222 4 222 333
我以为我可以用
array_push
做到这一点,但我没有让它工作。知道如何完成这项工作吗?
I have a
while
loop:$users = mysqli_query($con, "SELECT * FROM table"); while($row = mysqli_fetch_array($users)) { if ($row['column1'] != $row['column2']) { echo "There is a different between column1 and column2<br />"; } }
I want to get all the records where
column1
is different fromcolumn2
and get these values into an email.The email looks like this:
ID Column1 Column2 1 111 222 4 222 333
I thought I could do this with
array_push
but I'm not getting it to work.Any idea how to get this done?
原文:https://stackoverflow.com/questions/29167423
最满意答案
使用COM绑定调用
Unprotect
方法。import win32com.client excel = win32com.client.Dispatch('Excel.Application') workbook = excel.Workbooks.open(r'c:\mybook.xls', 'password') workbook.SaveAs('unencrypted.xls')
SaveAs可以应用新密码。 请参阅: http : //msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.workbook.saveas%28VS.80%29.aspx
Use the COM bindings to call the
Unprotect
method.import win32com.client excel = win32com.client.Dispatch('Excel.Application') workbook = excel.Workbooks.open(r'c:\mybook.xls', 'password') workbook.SaveAs('unencrypted.xls')
SaveAs can apply a new password. See: http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.workbook.saveas%28VS.80%29.aspx
相关问答
更多-
使用SSIS将具有相同列的Excel文件合并到一个Excel文件中(Merge Excel files having same columns into one excel file using SSIS)[2022-08-30]
为每个文件添加一个Excel源代码以加入它们的“联合所有”任务,因此如果您的第一个Excel上有20行而第二个上有30行,那么最终会有50行: 要设置源路径和目标路径,只需双击每个任务并设置连接管理器 编辑: 如何在此处读取excel文件的示例 add an Excel source for each of your files an a "union all" task to join them, so if you have 20 rows on your first excel and 30 on t ... -
解密excel文件(decrypt excel files)[2022-03-16]
使用COM绑定调用Unprotect方法。 import win32com.client excel = win32com.client.Dispatch('Excel.Application') workbook = excel.Workbooks.open(r'c:\mybook.xls', 'password') workbook.SaveAs('unencrypted.xls') SaveAs可以应用新密码。 请参阅: http : //msdn.microsoft.com/en-us/li ... -
你可以试着用这个加载文件在内存中: Stream exportData = new MemoryStream(byte[] fileBuffer); can you try to load the file in memory with this : Stream exportData = new MemoryStream(byte[] fileBuffer);
-
Excel文件和C ++(Excel files and C++)[2022-09-19]
如果您遇到非托管C ++并且需要直接与Excel通信,则需要COM自动化接口。 请参阅MSDN文章链接文本 如果你想要新的托管互操作的强大功能,我想你可能需要将你的C ++代码包装在一个interop dll中。 If you're stuck with unmanaged C++ and need to communicate directly with Excel you'll need the COM automation interfaces. See the MSDN article link t ... -
就像DaDaDom说的那样,Apache POI就是你正在寻找的东西。 你可以从这个页面下载它。 请注意,POI项目不完全独立,您可能需要下载一些额外的库。 按照Apache POI网站上的说明进行操作。 这是你如何使用它: InputStream myxls = new FileInputStream("workbook.xls")); HSSFWorkbook wb = new HSSFWorkbook(myxls); // for *.xlsx use XSSFWorkbook 如果它是一个新文件, ...
-
您需要的是PGP的COM或ActiveX组件,它解密PGP消息。 似乎有一些关于,例如这个 (这不是推荐,BTW!) 将它安装到您的PC上,然后在Excel VB窗口中通过Tools> References菜单添加项目引用:在列表中找到PGP组件并选择它。 然后,您可以使用它在VBA代码中公开的对象 - 您必须查看它为其公开的COM对象提供的任何文档以及如何使用它们。 干杯 - What you need is a COM or ActiveX component for PGP which decrypt ...
-
答案是否定的。 The answer is NO.
-
由Andy Khan发现了一个jExcelApi Found one jExcelApi by Andy Khan
-
您是否尝试将VBA代码保存在“.bas”文件中? 然后,您可以尝试通过Excel interop以编程方式添加代码。 如果这不起作用,为什么不简单地在Workbook_Open事件触发时添加以下代码: Private Sub Workbook_Open() Dim sModulePath As String sModulePath = "path" ThisWorkbook.VBProject.VBComponents.Import Filename:=sModulePath En ...
-
LibXL拥有商业许可和iOS支持199美元(目前)。 它可以在这里下载。 LibXL have a commercial license and iOS support for $199 (currently). It can be downloaded here.