i have created a database on wamp server and i can insert data into this database using this php code (find in the attachment) how can i insert data into this database using arduino code ?? if anyone can help me with sketch or some library or anything i will be thankfull
note: i have arduino mega and ethernet ENC25J60
i don't think you're using the right lib, Ethernet.h is used on the Wiznet shields, you should use something like this lib, although i don't think there's a "client mode" for the ENC28J60.
the ethernet shield ENC28J60 has its own library an i have downloaded it and from its examples WebClient example so it seems to be it can act like a client.
my question is how to write get request in the sketch for accessing PHP code that control a database created on wamp server ?
You can't see how to change this to call YOUR script, instead?
Quit being so thin skinned.
No one can tell you how to change that call to call your script, since you haven't told us where the script lives on you server (wherever it is replaces the / in that GET statement) or what the script is called (whatever it is replaces search in that GET statement) or what arguments it expects (whatever they are replaces the q=arduino in that GET statement).
The real question is how you access it from a browser. That is, where is the httpd daemon on the server going to look for the script, relative to some location. Most likely, it will look in the C:\wamp\www directory for named files, so the GET request would be:
No. What pointing a browser to localhost means is that the IP address is 127.0.01 (that is, the computer the browser is running on). No other computer can access that server using the localhost name, because localhost means me. If I point my browser at localhost/test/php_db.php, the browser is going to look for php_db.php on MY computer.
and the argument is temp1=25 and in this case i have to change the php script so what i have to write in the script ?
That's what goes in place of q=arduino in the sketch you posted, or someName=someValue in the GET statement I showed above.
mysql_query("INSERT INTO counter(counting) VALUES (test1)");
This query inserts hardcoded values to the database. To insert data passed to the script, you need to access the data using the $_GET variable (which contains name=value pairs) to get the value corresponding to the name you used in the GET request (temp1 in the example we were discussing earlier).
This has really moved beyond an Arduino issue, to a PHP, MySQL, client/server issue, and really does not belong in this forum anymore.
and i have this in serial monitor
Well, that's a different issue. The server that you are trying to access, 192, 168, 42, 1, doesn't look right. Typically, on a home network (which the 192.168 part implies), the third field is either 0 or 1. The last field is the specific device. Typically, 1 is the router. Device addresses start from 2 and go up.
this IP when i write this ip 192.168.1.2 in the web browser URL it direct to my local host so it seems to be the IP for the wamp server and i put it into sketch and the serial monitor gave me the same result