Jump to content

php and autoit


seesoe
 Share

Recommended Posts

i have an online ordering site i wrote fully in php, and when an order gets submitted i want to send the order to a server thats in my store and print it out

i have a mysql database with all the menu items and the clients order info. can autoit connect to my sites sql server and get info from it?

i was thinking best way is to have an autoit program on the server that will read a file from my site that is written to when the order is placed, and let the program go from there.

or i was thinking if this is possible with autoit to have my site run like a php socket client and run a autoit socket server on the server and read from the database for more info too.

whats your opinion on this project? what would be the best method to follow?

suggests and comments welcome:D:)

thanks cheerrs

seesoe

Link to comment
Share on other sites

How about you search for the MySQL UDFs (there are more than one! Each is explanatory with the differences).

As for the second part, it sounds more trouble than it's worth... But then again I reckon it would be pretty interesting to implement...

Cheers

Brett

Link to comment
Share on other sites

i saw a lot of sql udf's but some needed mysql server site install of something, its a messy udf

so socket between php and autoit would be plausible?

i already wrote the whole shopping cart system and database from scratch, its for a restaurant

Link to comment
Share on other sites

i dont want to install php on the server at the store it already runs a security server that makes it slow (its a sucky pc to start with) and that would help anyways to print localy on requests

i didn't think i simple socket server in autoit and php client would be that hard:S

Link to comment
Share on other sites

It is a viable option I suppose but just seemed a little over board considering it could all be done much easier just using PHP and connecting to the remote SQL server and writing the info to a file. Then maybe having autoit print out the file or something. Even the SQL UDF's would be much easier imo as mentioned before.

Link to comment
Share on other sites

yeah my original idea was to do something like that; using autoit to read a file that php will write too, but i was just wondering about the socket connection just for kicks, im using this whole project as a learning curve, i first started writing the system with sessions then i moved to database.

what would be the best way to approach this setup if i want autoit to connect to the sql database and always be ready to read the next job and print? in the database i have a column called status that will say submitted or canceled....

Edited by seesoe
Link to comment
Share on other sites

I haven't really worked that much with the SQL stuff at all. This is a modified example of a script I made that did something completely different. This is just a start and give you an idea of what your program could be like.

#Include <mysql.au3>

$file = "whatever.txt"

While 1
    Sleep(60000) ;check every minute                    
    $sql = _MySQLConnect("root", "", "database_name", "localhost") ;CHANGE LOGIN LOCATION and credentials
    If NOT @error Then                                              
        $query = ("Select * FROM database_name ;");blah blah blah sql statement
        $result = $sql.execute($query)
        If NOT @error Then 
            FileWrite($file, $query) ;write it to a file and do whatever else you need to do with it
        EndIf
        _MySQLEnd($sql) 
    EndIf
WEnd
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...