Go Down

Topic: Help: arduino php mysql (electronic toll booth) (Read 2071 times) previous topic - next topic

nikpawar

i m building an electronic toll collection system based on arduino and rfid;i m done with rfid part of the project but i m stucked with the database part of it;i m searching for solutions since weeks but i m nt able to find feasible soltn for this prob;can somebody tell me how do i send unique 10 digit unique id of the rfid to a php code which then queries the mysql db...please help guys..

wizdum

http://www.w3schools.com/php/default.asp
and
http://www.w3schools.com/sql/default.asp
should help.

You use some kind of network interface card (either ethernet shield or a wifi shield) to connect the arduino to the network that the server is on.
"Anyone who isn't confused really doesn't understand the situation."

Electronic props for Airsoft, paintball, and laser tag -> www.nightscapetech.com

Coding Badly


nikpawar

sorry for the cross post...
i m  using ethernet sheild;thnks for the links but tell me how do i implement it in arduino sketch. i do have rough ideas like sending unique id using HTTP get/post method or like using php serial class for reading serial data..but i need one successful example to know how it works lyk.i simply want to send unique id of rfid tag to php script..after tht i cn manage things

AWOL

Please can you stop using colloquial abbreviations and start using the shift key?
It makes reading your posts very hard to to those who don't understand your dialect.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Quick5pnt0

Exactly which part are you stuck with? At first it sounded like you needed help with databases but then you mention being stuck implementing it with the arduino. What have you tired so far?

nikpawar

Till now i have interfaced the RFID reader with the Arduino;now i want to pass the 10 digit unique ID read by the RFID reader to the PHP script which will then deduct the toll fee from the mysql database.i want to some how pass the unique id from arduino to php script which is stored on the local web server.

wildbill

Here's a function I use to send temperature data to a web server:
Code: [Select]

void  SendTempToServer()
{ // Use a GET to pass the temp we received to Natasha
char GetRequest[80];
if (client.connect(server, 80))
  {
  sprintf(GetRequest,"GET /cgi-bin/Arduino.cgi?Reading=%s&arduino_id=23&sensor_id=1",Temperature);
  //Serial.println(GetRequest);
  client.println(GetRequest);
  client.println();
  }
}

Something similar should be what you need.

nikpawar

ok thanks for the reply...i'll try to implement it in my project.

Jimmy60

Here's a couple of links that may be useful to you. They deal with reading serial ports with PHP. Once you can get PHP to read the data storing it is easy. PHP and mysql get along nicely. Can we assume your server is just a LAMP box?

http://code.google.com/p/php-serial/

http://stackoverflow.com/questions/11628002/php-read-data-from-serial-port-on-linux

nikpawar

thank you very much for the links..unfortunately i m using windows and my server is apache(part of XAMPP package)..still i'll try to use your reference if it works.thanks again..
once i am done with my project i'll post it to community..i am finding many people with the similar problem.

wildbill

Per your request, the whole thing is attached. The code is for an arduino ethernet with an Xbee. It receives temperature data from another arduino and then sends it to a web server. Obviously, you can drop the xBee stuff and put in your own temp reading. The original version just used wifi and the sensing arduino sent the temps direct but it didn't work in the target location because the wifi signal was too weak.



Chagrin

This is wrong and will cause a 400 error:
Code: [Select]

client.print("GET try.php?code=");

Should be:
Code: [Select]

client.print("GET /try.php?code=");


Also, suggest you use HTTP/1.0 instead of HTTP/1.1. The latter will cause a "keepalive" request and does not close the connection after the request is complete.

nikpawar

i have made changes which u have suggested but still its not working :smiley-sleep:

Go Up