Need Help, Database problems, Urgent for school!

I want to save something in my database but it didnt’ work, nothing happens, the server that’s the website i’m trying to send to, it says ‘connected’ but when i check my db i find nothing… i don’t know what’s the problem is it from ip or i don’t know… (Phpmyadmin is my db domain)

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

char server[] = "projetec.orgfree.com";   

IPAddress ip(192, 168, 1 , 9);
EthernetClient client;
void setup() {

 Serial.begin(9600);
 while (!Serial) {
   ; 
 }

 if (Ethernet.begin(mac) == 0) {
   Serial.println("Failed to configure Ethernet using DHCP");
 
 }
 
 delay(1000);
 Serial.println("connecting...");

 if (client.connect(server, 80)) {
   Serial.println("connected");
  client.println("GET /ajout.php?Temp=19&Hum=19 HTTP/1.1");
   client.println("HOST: projetec.orgfree.com");
   client.println("Connection: close");
   client.println();
 } else {
   Serial.println("connection failed");
 }
}
void loop() {
 if (client.available()) {
   char c = client.read();
   Serial.print(c);
 }

 if (!client.connected()) {
   Serial.println();
   Serial.println("disconnecting.");
   client.stop();

   while (true);
 }
}

Bump, anyone please..

Bump after 23 minutes?

Your panic ain't my panic.

Pete

It is difficult to help with a problem when we have no idea what the problem is. We could take the time to study your code and try to figure it out, but that would take time away from people who have read the forum stickies and posted their code properly and defined the problems with their project.

Kay mates sorry but i was in a hurry i'll wait, thanks.

cAriek:
Kay mates sorry but i was in a hurry i'll wait, thanks.

Unless you tell us what the problem is you may wait for ever.

In the meantime perhaps you could edit your post and put the code in code tags. Don't know how to do it ? Then read read this before posting a programming question

cAriek:
Kay mates sorry but i was in a hurry i'll wait, thanks.

With an initial post like that you’re going to be waiting a LONG time. At a minimum you should:

gfvalvo:
With an initial post like that you’re going to be waiting a LONG time. At a minimum you should:

UKHeliBob:
Unless you tell us what the problem is you may wait for ever.

In the meantime perhaps you could edit your post and put the code in code tags. Don't know how to do it ? Then read read this before posting a programming question

Done fixed, my bad i thought that i did it right but i missclicked, thanks again.

How about those things you were asked to explain. Come on man, if you're really in a hurry then this is all stuff you should think about before you start. You know we will need to know what the problem is in order to help you fix it.

Delta_G:
How about those things you were asked to explain. Come on man, if you're really in a hurry then this is all stuff you should think about before you start. You know we will need to know what the problem is in order to help you fix it.

i did explain the problem check at the top of the page, before posting the code i explained my problem !

cAriek:
i did explain the problem check at the top of the page,

Don’t make big changes to earlier Posts so that people have to go back up the page. It just makes a nonsense of the flow of the discussion.

Post new stuff in a new Reply.

…R

Robin2:
Don't make big changes to earlier Posts so that people have to go back up the page. It just makes a nonsense of the flow of the discussion.

Post new stuff in a new Reply.

...R

Kay my problem is that i'm trying to send something from my arduino card to my database, it says 'connected' but nothing happens, i don't find anything in my database when i check, there's a problem somewhere in my program but can't find it, ip thing or i don't know, u guys know better, thanks again.

Ok. If you think that’s enough detail then you can just wait until someone comes along that can figure it out from that. I thought you were in some sort of hurry so I thought you might want to be a little more detailed. But it’s up to you.

I think knowing what type of database might be helpful. There are many other details you could include. But if you want to wait for someone who can guess those things from your code then go ahead.

Delta_G:
someone who can guess those things from your code then go ahead.

I'm beginning to wonder if it is his own code or if he himself knows anything about what it does. or should do.

...R

  • What does the code you provided us have to do with ANYTHING database related?
  • What type of database? SQL? MySQL? Other?
  • You didnt bother to even let us know what type of server side scripting language you are using to even attempt a DB connection and insert/select....etc

One can get this info by looking at the endpoint URL you are attempting to connect to.

PHP.

So you have a PHP script that is attempting to do some database 'actions'...

Have you proivded us with the PHP script/code? (I didnt see it)

Since the PHP script is not only the connection,... but also the 'worker' doing the table insertion..etc We'd porbably need to see that....... no?

Search my nic.. and key word WAMP.. I have posted several different projects including all sketches, source PHP files, and MySQL table setup files......

what is this domain even: Error

Some free hosting domain space? And they give you database......free?

I question this whole set-up now..

xl97:
what is this domain even: projetec.orgfree.com/ajout.php

Some free hosting domain space? And they give you database…free?

I question this whole set-up now…

<?php 
$base = mysql_connect('localhost', '1317483', 'password') or die("unable to connect to db"); ; 
mysql_select_db('1317483',$base);
 
$a=$_GET['ID'];
$b=$_GET['Temp'];
$c=$_GET['Hum'];
 
//$sql = "SELECT * FROM info WHERE id='$a'";
//$res=mysql_query($sql) or die('Error selection'.mysql_error());
 
 
       $sql = "INSERT INTO Essai VALUES('$a','$b','$c')";
       mysql_query($sql) or die('Error selection'.mysql_error());
 
		$insertGOTO="index.html";
		header(sprintf("Location:%s",$insertGOTO)); 	
 
 
 
 
?>
  • that’s the ajout.php code, with that i add values to my database.
  • Phpmyadmin is where i created this db.
  • SQL is the type of db.
  • projetec.orgfree.com is the website i created where i can find my ftp and things like that, created it from ‘freewebhostingarea.com

cAriek:

<?php 

$base = mysql_connect(‘localhost’, ‘1317483’, ‘password’) or die(“unable to connect to db”); ;
mysql_select_db(‘1317483’,$base);

$a=$_GET[‘ID’];
$b=$_GET[‘Temp’];
$c=$_GET[‘Hum’];

//$sql = “SELECT * FROM info WHERE id=’$a’”;
//$res=mysql_query($sql) or die(‘Error selection’.mysql_error());

$sql = “INSERT INTO Essai VALUES(’$a’,’$b’,’$c’)”;
      mysql_query($sql) or die(‘Error selection’.mysql_error());

	$insertGOTO="index.html";
	header(sprintf("Location:%s",$insertGOTO)); 	

?>



* that's the ajout.php code, with that i add values to my database.
* Phpmyadmin is where i created this db.
* SQL is the type of db.
* projetec.orgfree.com is the website i created where i can find my ftp and things like that, created it from 'freewebhostingarea.com'

Well… I guess I cant comment about the hosting/domain stuff… (maybe it works without issue?)
That being said… WOWZERS MAN!.. I wouldnt use that script if I were you!.
I would switch to PDO and prepared statements…etc…
At the very least sanitize your data!.. That script is totally open to injection attacks!! :slight_smile:
Does the script work ‘as-is’? Can you load that up in your browser and get it to insert data?
If not… then you know the problem isnt on the Arduino side of things… (or at least not yet) :slight_smile:

Also says your script can not be found… so the path is not correct.

if this is it: projetec.orgfree.com/ajout.php (nor does that url look even remotely compliant/legit)

xl97:
Well.. I guess I cant comment about the hosting/domain stuff.. (maybe it works without issue?)
That being said.. WOWZERS MAN!.. I wouldnt use that script if I were you!.
I would switch to PDO and prepared statements..etc..
At the very least sanitize your data!.. That script is totally open to injection attacks!! :slight_smile:
Does the script work 'as-is'? Can you load that up in your browser and get it to insert data?
If not.. then you know the problem isnt on the Arduino side of things.. (or at least not yet) :slight_smile:

Also says your script can not be found.. so the path is not correct.

if this is it: Error (nor does that url look even remotely compliant/legit)

i don't really care about the attacks, ik that that domain sucks but i've to use it even if i don't want to i have to, it's for school, they told me to use that anyways there's a commmand i use : Error , that command works just fine, my database is working fine, the php code is fine too but the problem is with arduino program i'm sure there's something wrong around, i don't know like the ip things idk what to put in there,i tried everything, or could it be from my arduino card? maybe it's broken or something..as i said database is fine, i can add things through ajout.php..

Hey, you could probably use some more help. If you would write something readable like you thought you were talking to a professional then I might chime in. But as long as you insist on writing like you are texting your boyfriend or girlfriend with no hope at all of punctuation or any capital letters or sentence structure and all the little txt speak abbreviations, well I just don't care enough about whether or not your project works to try to wade through all that and make sense.

I'm not trying to pick on you dude, just saying that if you really want to get this done then you might consider being considerate enough to try to write something at least close to properly. It will probably get you more help. I know I'm not the only one who will just skip a thread if the OP makes themselves look like an idiot to start with like that. Try to look like someone who is going to give me a high probability of being able to be helped, not a waste of time.

I'm guessing you're young. That stuff is going to get a LOT more important soon. The difference between the guy who makes a billion off of a half-assed idea and the guy who languishes away unemployed with the greatest invention ever that nobody will take seriously is quite often the ability to write and speak well. If you want people to take you seriously, then you have to look like you are taking things seriously.

Amen. If any of the engineers who work for me were that unable to write a readable and coherent problem statement, then they might not be working for me much longer.