I have a C# program that needs to pass specific values to our remote server nightly.
I already have a database “counter” with just a few tables: ClientID, ClientName, BoxesMoved, and ReportDate.
I need to pass the values through a simple post command WITHOUT THE USE OF A FORM, but things aren’t working properly. Here’s what I was starting with.
I was trying to pass the values like this: ( test.php?clientid=01?clientname=theclient?boxesmoved=185443?reportdate=07-17-2015). Is this possible, and where can I find any information to aid me in my process.
[php]<?php
$host=“localhost”; // Host name
$username=“root”; // Mysql username
$password=“password”; // Mysql password
$db_name=“counter”; // Database name
$tbl_name=“boxcounter”; // Table name
// Connect to server and select database.
mysql_connect("$host", “$username”, “$password”)or die(“cannot connect”);
mysql_select_db("$db_name")or die(“cannot select DB”);
// Get values from form
$clientid=$_POST[‘ClientID’];
$clientname=$_POST[‘ClientName’];
$boxesmoved=$_POST[‘BoxesMoved’];
$reportdate=$_POST[‘ReportDate’];
// Insert data into mysql
$sql=“INSERT INTO $tbl_name(reportdate, clientid, boxesmoved, clientname)VALUES(’$ClientID’, ‘$ClientName’, ‘$BoxesMoved’, ‘$ReportDate’, )”;
$result=mysql_query($sql);
// if successfully insert data into database, displays message “Successful”.
if($result){
echo “Successful”;
}
else {
echo “ERROR”;
}
?>