MYSQL quarry

HI all

how can I quarry MySQL with a value

I use

#include <UIPEthernet.h>
#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>

uint8_t mac[6] = {0x00,0x01,0x02,0x03,0x04,0x05};

IPAddress server_addr(10,0,0,231);  // IP of the MySQL *server* here
char user[] = "root";                        // MySQL user login username
char password[] = "";

char query_value = "";
char query[] = "SELECT UID,Holder FROM arduino.tab1 WHERE Email = query_value";

EthernetClient client;
MySQL_Connection conn((Client *)&client);
// Create an instance of the cursor passing in the connection
MySQL_Cursor cur = MySQL_Cursor(&conn);

void setup() {

  while (!Serial); // wait for serial port to connect
  Ethernet.begin(mac); //Configure IP address via DHCP

  Serial.print("ip address: ");
  Serial.print("subnetMask: ");
  Serial.print("gatewayIP: ");
  Serial.print("dnsServer: ");

  Serial.print(server_addr);Serial.print(" ");
  Serial.println("Connecting...TO MYSQL PORT 3306");
  if (conn.connect(server_addr, 3306, user, password)) {
    Serial.println("Connection failed.");

void loop() {

      if (client.available()){}


  Serial.println("\nRunning SELECT and printing results\n");

  // Initiate the query class instance
  MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn);
  // Execute the query
  // Fetch the columns and print them
  column_names *cols = cur_mem->get_columns();
  for (int f = 0; f < cols->num_fields; f++) {
    if (f < cols->num_fields-1) {
      Serial.print(", ");
  // Read the rows and print them
  row_values *row = NULL;
  do {
    row = cur_mem->get_next_row();
    if (row != NULL) {
      for (int f = 0; f < cols->num_fields; f++) {
        if (f < cols->num_fields-1) {
          Serial.print(", ");
  } while (row != NULL);
  // Deleting the cursor also frees up memory used
  delete cur_mem;


so I wont to quarry with query_value
I cant do that Iam getting error all the time

Error: 55 = Unknown column ‘query_value’ in ‘where clause’.

instead of this:

char query_value = "";
char query[] = "SELECT UID,Holder FROM arduino.tab1 WHERE Email = query_value";

try this:

char query[] = "SELECT UID,Holder FROM arduino.tab1 WHERE Email = \'\'";

just to see if the error goes away.

If you want to use two different variables, and that IS a good idea, then you need to combine the value in one variable into the other yourself. You can't expect that to automatically happen.

char query_value[] = ""; // This string will NOT fit in a char
char query[80] = "SELECT UID,Holder FROM arduino.tab1 WHERE Email = "; // Remove the useless name and define the size so that it can have the value concatenated
strcat(query, query_value);

This is just to give you an idea. It will NOT work, because in the query, the value for the where clause needs to be in single quotes, so you really need to concatenate three strings, one of which contains only a single quote.