dousi8931 2013-03-31 03:08
浏览 122

使用VB6创建.php或.txt文件

So I'm trying to finish up my website, but since it has a lot of pages I want to speed up the process.

Every post I make needs a .SQL file with the data that will later be used in the .php file to fill everything, now, what I want to do is fill out the info on a VB6 form so that it'll put the data on my database and create a .php file with the given text (that will include all html and php code as well as the variables for every specific post) or a .txt file so I can later just change its extension.

How could I do this?

I'm sorry if I didn't express myself well and thanks in advance, cheers!

EDIT: I know I could do it with just getting the data from my database and having a single dynamic php file, but trust me, for what I need it's better having different files.

Also yes, I meant by ".SQL file" that it'll be just a row in my database.

So basically what I need is to write a certain text on a .txt file (preferably save it with the .php extension) and also for the program to write the data on my database (I already did that part).

Again, sorry for the poor explanation.

  • 写回答

1条回答 默认 最新

  • duanjihe5180 2013-04-01 11:09
    关注

    A better way to do what you want is to create a form handler (which wont be visible). And the form handler will take your form data and instantiate it (create/update/delete) form the rows in your SQL DB.

    Additionally you can upload the handler as required via your vb6 application and REMOVE it after your done with the updates to your SQL DB.

    Also if you have more than row that you wish to create/update/delete, then you could recursively send the form data to your Form handler.

    Pass your data in a generic HTML form which you ought ot be able to create dynamically on the fly using plain text.

    This approach will work for strings and numbers but not for images which usually need to be chunked.

    Once your handler has processed the request it can redirect you to a "Success.html" or "Failed.html" page so you know it if succeeded or not.

    Pseudo code for HANDLER.ASPX or HANDLER.PHP:

    If formdata is valid
      try
        create/update/delete row in SQDB
        redirect to success.html?action=create or update or delete
      catch
        redirect to failed.html?errorid=12345
      end try
    else
      redirect to failed.html?errorid=12345
    end if
    

    HTML form script (you will generate this in vb6 in your vb code):

    <form action="myhandler.aspx" method="post">
        <input type="text" id="recordId" value="123" />
        <input type="text" id="firstname" value="Bob" />
        <input type="text" id="lastname" value="Smith" />
        <input type="text" id="Street" value="123 high lane" />
        <input type="text" id="District" value="Moss Side" />
        <input type="text" id="City" value="Manchester" />
    </form>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题