MySQL Forums
Forum List  »  Connector/Arduino

Arduino MySQL Connector Select Query- How to access individual values
Posted by: Patrick LAFFORGUE
Date: January 25, 2015 04:42AM

Hello,

thanks for this helpfull and usefull Arduino MySQL Connector.
I try to command LEDs on an Arduino board from a HTML page using a PHP script and a MySQL Database. I succeed in updating the MySQL Database, reading it with Arduino board and displaying the pin states on the serial monitor. But I didn't succeed in accessing the individual pin state. Where is my mistake ?

Thanks in advance for your help.

Best regards.

Here is the concerned part of the code :

int Pin0, Pin1, Pin2, Pin3, Pin4, Pin5 ;

.......

if (r)
{
rows++;
for (int i = 0; i < num_cols; i++)
{
Serial.print(r->values);

if (i == 0) Pin0 = atoi(r->values[0]) ;
if (i == 1) Pin1 = atoi(r->values[1]) ;
if (i == 2) Pin2 = atoi(r->values[2]) ;
if (i == 3) Pin3 = atoi(r->values[3]) ;
if (i == 4) Pin4 = atoi(r->values[4]) ;
if (i == 5) Pin5 = atoi(r->values[5]) ;
else break ;
}

my_conn.free_row_buffer(); // Free the row buffers
}
} while (r);

Serial.println() ;
Serial.print(rows);
Serial.println(" rows in result");

Serial.println(Pin0);
Serial.println(Pin1);
Serial.println(Pin2);
Serial.println(Pin3);
Serial.println(Pin4);
Serial.println(Pin5);

Options: ReplyQuote


Subject
Views
Written By
Posted
Arduino MySQL Connector Select Query- How to access individual values
7436
January 25, 2015 04:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.