Why Can't I send data through wifi to mysql database

First of all, i don’t know how to get data by PHP file.
I host a WAMP PHP server and database, and i don’t know how to get data by the code below.

Second, the arduino code doesn’t work for me, what’s the problem with my code

Can somebody give me a hand?
I feel hopeless now.

#!/usr/bin/php-cli
<?php
$temperature = $argv[1]; 
$DBServer = 'localhost'; 
$DBUser   = 'TIM';
$DBPass   = '51354181';
$DBName   = 'artemp';  
$conn = new mysqli($DBServer, $DBUser, $DBPass, $DBName);
// check connection
if ($conn->connect_error) {
  trigger_error('Database connection failed: '  . $conn->connect_error, E_USER_ERROR);
}
$sql="INSERT INTO tmonitor (monitor) VALUES ('$temperature')";

if($conn->query($sql) === false) {
  trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
} 
?>
#include <Process.h>
#include <Bridge.h>
int temperature;
void setup() {
  Bridge.begin();  // Initialize Bridge
}
void loop() {
  int temperature = random(0, 100);
  Process p;               
  p.begin("http://timblog.tk/db/db.php");
  p.addParameter(String(temperature));
  if(p.run()){
    Serial.println("sending");
  }else{
    Serial.println("not sending");
  }
  delay(5000);
}

The error code for the php:

Notice: Undefined variable: argv in D:\wamp\www\db\db.php on line 3

The client print of arduino:

not sending

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld.sock’ (146)

I can’t set up mysql on YUN how can i solve it??

WAMP PHP server:

remove “#!/usr/bin/php-cli” line

<?php
$temperature = $_GET["temperature"]; 
$DBServer = 'localhost'; 
...

Test with browser “http://WAMP_ip/db/db.php?temperature=100”.

Arduino:

...
  Process p;               
  p.begin("curl");
  p.addParameter("http://timblog.tk/db/db.php?temperature=" + String(temperature));
...

Dear sonnyyu:

I can send the data to data base now. Here is my work: http://timblog.tk/chartphp/

Because of your useful hint, I became one of your fans.

I will do some IR control of Dehumidifier, air conditioner, and radiators. It's a lot of fun to edit PHP, Arduino, and Mysql.

There are many things to learn including hardware, software, firmware, website, and database.

My facebook is https://www.facebook.com/zhengtingc Thumb-up is really needed.

I'm now organizing notes of this three-day journey. I've learned something. Thanks for your help sincerely.

B.R Tim Chen

Dear Tim,

Can you please give me the full arduino code? Because I am also facing the same problem.