i have c# program needs pass specific values our remote server nightly.
i have database "counter" few tables: clientid, clientname, boxesmoved, , reportdate.
i need pass values through simple post command without use of form, things aren't working properly. here's starting with.
i trying pass values this: ( test.php?clientid=01?clientname=theclient?boxesmoved=185443?reportdate=07-17-2015) more experienced developers know, didn't work. possible, , can find information aid me in process.
<?php $host="localhost"; // host name $username="root"; // mysql username $password="password"; // mysql password $db_name="counter"; // database name $tbl_name="boxcounter"; // table name // connect server , select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select db"); // values form $clientid=$_post['clientid']; $clientname=$_post['clientname']; $boxesmoved=$_post['boxesmoved']; $reportdate=$_post['reportdate']; // insert data mysql $sql="insert $tbl_name(reportdate, clientid, boxesmoved, clientname)values('$clientid', '$clientname', '$boxesmoved', '$reportdate', )"; $result=mysql_query($sql); // if insert data database, displays message "successful". if($result){ echo "successful"; } else { echo "error"; } ?> <?php // close connection mysql_close(); ?>
you looking variables in $_post should looking @ $_get if passing them through url that.
also, mysql_
functions deprecated, , way using them opens sql injection.
Comments
Post a Comment