Read Personal Information From RFID tag And send to DataBase(Ethernet shield)

Hello,

I am trying to read the Personal information from the rfid tag And trying to upload the details to the database by using Ethernet shield(ethernet shield w5100) . I have successfully uploaded the Serial number of the tag . But when i am trying to upload the personal data i am facing some kind of issue . The code read the all information from the tag. I am using the MFRC522.

/----------------------------------------------------//
Here is the Code
/-----------------------------------------------------/
#include <Ethernet.h>
#include <SPI.h>
#include <MFRC522.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = {192, 168, 0, 13 }; //Enter the IP of ethernet shield
byte serv[] = {192, 168, 0, 3} ; //Enter the IPv4 address
EthernetClient cliente;
#define RST_PIN 6 // Configurable, see typical pin layout above
#define SS_PIN 7 // Configurable, see typical pin layout above
int m_id =2;
//int tag_id =1212;
//unsigned int num;

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance

//*****************************************************************************************//
void setup() {
Serial.begin(9600); // Initialize serial communications with the PC
Ethernet.begin(mac, ip);
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522 card
Serial.println(F("Read personal data on a MIFARE PICC:")); //shows in serial that it is ready to read
}

//*****************************************************************************************//
void loop() {

// Prepare key - all keys are set to FFFFFFFFFFFFh at chip delivery from the factory.
MFRC522::MIFARE_Key key;
for (byte i = 0; i < 6; i++) {
key.keyByte = 0xFFF;

  • }*

  • byte block;*

  • byte len;*

  • MFRC522::StatusCode status;*

  • //-------------------------------------------*

  • // Look for new cards*

  • if ( ! mfrc522.PICC_IsNewCardPresent()) {*

  • return;*

  • }*

  • // Select one of the cards*

  • if ( ! mfrc522.PICC_ReadCardSerial()) {*

  • return;*

  • }*
    _ Serial.println(F("Card Detected:"));_

  • //-------------------------------------------*

  • //-------------------------------------------*

  • Serial.println();*

  • Serial.print(F("PI, L/C, S/O, P/O Number: "));*

  • byte buffer1[18];*

  • block = 4;*

  • len = 18;*

  • //------------------------------------------- GET FIRST NAME*

  • status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, 4, &key, &(mfrc522.uid)); //line 834 of MFRC522.cpp file*

  • if (status != MFRC522::STATUS_OK) {*

  • Serial.print(F("Authentication failed: "));*

  • Serial.println(mfrc522.GetStatusCodeName(status));*

  • return;*

  • }*

  • unsigned long num=mfrc522.MIFARE_Read(block, buffer1, &len);*
    //num.concat(String(mfrc522.MIFARE_Read(block, buffer1, &len)));

  • status = mfrc522.MIFARE_Read(block, buffer1, &len);*

  • // String num= "";*

  • // num.concat(String(buffer1[18]));*

  • // Serial.print("num = ");*

  • // Serial.println(num);*

  • if (status != MFRC522::STATUS_OK) {*

  • Serial.print(F("Reading failed: "));*

  • Serial.println(mfrc522.GetStatusCodeName(status));*

  • return;*

  • }*

  • //PRINT FIRST NAME*

  • //String num="";*

  • for (uint8_t i = 0; i < 16; i++)*

  • {*
    _ if (buffer1 != 32)_
    * {*
    _ Serial.write(buffer1*);
    }
    }*_

Serial.flush();
* //---------------------------------------- GET LAST NAME*
* byte buffer2[18];*
* block = 1;*
* status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, 1, &key, &(mfrc522.uid)); //line 834*
* if (status != MFRC522::STATUS_OK) {
_ Serial.print(F("Authentication failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}_
status = mfrc522.MIFARE_Read(block, buffer2, &len);
if (status != MFRC522::STATUS_OK) {
_ Serial.print(F("Reading failed: "));
Serial.println(mfrc522.GetStatusCodeName(status));
return;
}
Serial.println();
//PRINT LAST NAME*
* for (uint8_t i = 0; i < 16; i++) {*
Serial.write(buffer2 );
* }*_

// if (cliente.connect(serv, 80)) {
* //-----------*
* //Serial.print(F("Card UID:"));*
* String content= "";*
* String hexuid= "";*
* for (byte i = 0; i < mfrc522.uid.size; i++) {*
_ //Serial.print(mfrc522.uid.uidByte*);
//Serial.print(mfrc522.uid.uidByte, DEC);
content.concat(String(mfrc522.uid.uidByte < 0x11 ? "0":""));
content.concat(String(mfrc522.uid.uidByte, DEC));
hexuid.concat(String(mfrc522.uid.uidByte, HEX));
}
Serial.println();
//---------
/Ethernet connection///Connecting at the IP address and port we saved before_

if (cliente.connect(serv, 80)) {
_// byte i = 0; i < mfrc522.uid.size; i++;
Serial.println("connected");
cliente.print("GET /inventory/data4.php?"); //Connecting and Sending values to database
cliente.print("tag_id=");
cliente.print(content);
cliente.print("&tag_uid=");
cliente.print(hexuid);
cliente.print("&m_id=");
cliente.print(m_id);
//---------------------
for (uint8_t i = 0; i < 16; i++)
{
if (buffer1 != 32)
{
Serial.write(buffer1);
}
cliente.print("&Name=");_

_cliente.print(buffer1);
}*_

//---------------------
cliente.stop(); //Closing the connection
}
else {
// if you didn't get a connection to the server:
Serial.println("connection failed");
}
* //----------------------------------------*
_ Serial.println(F("\nEnd Reading\n"));
* delay(1000); //change value if you want to read cards faster*
* mfrc522.PICC_HaltA();
mfrc522.PCD_StopCrypto1();*

}
/-----------------------------CODE ENDS-------------/
/-----------------------Php Code (data4.php)--------------/


Sensor Data


<?php*_ _*include ('config.php');*_ *$sql_insert = "INSERT INTO inv_data1 (tag_id, tag_uid, name, machine_id, is_deleted) VALUES ('".$_GET["tag_id"]."', '".$_GET["m_id"]."', '".$_GET["name"]."', '".$_GET["tag_uid"]."', '0')";* *if(mysqli_query($con,$sql_insert))* _*{*_ _*echo "SUCESS";*_ *mysqli_close($con);* _*}*_ _*else*_ _*{*_ *echo "error is ".mysqli_error($con );* _*}*_ _*?>
/----------------php code (data4.php)--- Ends Here--------------/
/-----------------Config.php---------------/


TAG TRACKING


<?php*_
_*//header("Refresh:0.2;");*_ *date_default_timezone_set("Asia/kolkata");* _*// location.reload();*_ _*$username = "root";*_ _*$pass = "";*_ _*$host = "localhost";*_ *$db_name = "test";* *$con = mysqli_connect ($host, $username, $pass);* *if ($db = mysqli_select_db ( $con, $db_name )) {* _*echo " ";*_ _*}*_ _*else {*_ _* echo "faield";*_ _*}*_ _*//include ('data.php');*_ _*?>
/----------------------*/

Please Help me .
Thank_