Sign in to follow this  
Followers 0
pixi

MySQL question

3 posts in this topic

#1 ·  Posted (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 by pixi

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0