pixi Posted June 22, 2008 Share Posted June 22, 2008 (edited) Hello Eveyone! Can sombody help me how i will write in the script to get the data in mysql like this in one row DateTime____________total________watt 2008-06-21__________ 000197_____ 000453 whith this script i will get 3 rows like this DateTime total watt 2008-06-21 ____________ 000197 ______________________ 000453 i have tried to read the mysql.au3 manual and the exampel but i dont know how to fixit. :-( #include <mysql.au3> $var1 = FileReadLine ("C:/hager/log.txt",1) $datetime = Stringleft($var1,19) $total= Stringright($var1,8) $watt = StringMid($var1,20,10) $sql = _MySQLConnect('root','*****','192.168.1.2','temp') _MysqlAddRecord($sql, 'el','DATETIME',$datetime) _MysqlAddRecord($sql, 'el', 'TOTAL',$total) _MysqlAddRecord($sql, 'el', 'WATT', $watt) _MySQLEnd($sql) /Andreas Edited June 22, 2008 by pixi Link to comment Share on other sites More sharing options...
sachmizzle Posted June 27, 2008 Share Posted June 27, 2008 Hello Eveyone! Can sombody help me how i will write in the script to get the data in mysql like this in one row DateTime____________total________watt 2008-06-21__________ 000197_____ 000453 whith this script i will get 3 rows like this DateTime total watt 2008-06-21 ____________ 000197 ______________________ 000453 i have tried to read the mysql.au3 manual and the exampel but i dont know how to fixit. :-( #include <mysql.au3> $var1 = FileReadLine ("C:/hager/log.txt",1) $datetime = Stringleft($var1,19) $total= Stringright($var1,8) $watt = StringMid($var1,20,10) $sql = _MySQLConnect('root','*****','192.168.1.2','temp') _MysqlAddRecord($sql, 'el','DATETIME',$datetime) _MysqlAddRecord($sql, 'el', 'TOTAL',$total) _MysqlAddRecord($sql, 'el', 'WATT', $watt) _MySQLEnd($sql) /Andreas haven't been using mysql that long, but the way i add to tables is by using the _Query function, like this $aq = "INSERT INTO " & $Tablename & " VALUES ('" & $datetime & "','" & $total & "','" & $watt & "');" $aQuery = _Query($sql, $aq) not sure if it'll help you or not, but it seems to work fine for me, at least so far ;o Link to comment Share on other sites More sharing options...
pixi Posted July 1, 2008 Author Share Posted July 1, 2008 haven't been using mysql that long, but the way i add to tables is by using the _Query function, like this $aq = "INSERT INTO " & $Tablename & " VALUES ('" & $datetime & "','" & $total & "','" & $watt & "');" $aQuery = _Query($sql, $aq) not sure if it'll help you or not, but it seems to work fine for me, at least so far ;o Tankyou i also found out that is easyer to use a simple insert question insted of _mysqladrecord 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