Jump to content

MySQL question


Recommended Posts

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 by pixi
Link to comment
Share on other sites

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

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

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...