PHP Post upload, unable to read the uploaded string

Source: Internet
Author: User
Native C # is written with the WebClient class http://1.liuruitao.sinaapp.com/test.php?name={0} uploaded through this URL, the page over there

if ($_server[' Request_method ']== "POST")
{
$s =json_encode ($_post)

$s =$_get["name"];
echo "Hello world!!";
echo $_post["name"];
$conn =mysql_connect (sae_mysql_host_m. ': '). Sae_mysql_port,sae_mysql_user,sae_mysql_pass);
if (! $conn)
Die ("Connect fail". Mysql_error ());
mysql_select_db (' App_liuruitao ', $conn);
$sql = "INSERT into $db values (' 3344556677 ', $s, 3, ' 4 ', 5, ' 6 ', ' 7 ', ' 8 ', ' 9 ')";
mysql_query ($sql, $conn);//Use SQL statements to insert data
Mysql_close ();//close MySQL connection
echo "Insert Success";
}
is not correctly get the uploaded name inside the string inserted into the database, everybody help thank you


Reply to discussion (solution)

echo $_post["name"]; Change to Print_r ($_request); try it.

Can I get a value or cannot insert a value?

Can I get a value or cannot insert a value? It feels like it's got a value, but I'm not sure what it is, he can't get into the database, it's like a type problem.

echo $_post["name"]; Change to Print_r ($_request); Try it, you can't try it. The code put it on the server, and he did it. I can't control it.

Http://1.liuruitao.sinaapp.com/test.php? NAME={0}
Obviously name should be obtained from the $_get array
$s =$_get["name"];

$sql = "INSERT into $db values (' 3344556677 ', $s, 3, ' 4 ', 5, ' 6 ', ' 7 ', ' 8 ', ' 9 ')";
Estimating the problem here
When you build a table, you have a field that is the only primary key, and the primary key cannot be duplicated, otherwise it is not unique.
If the primary key is self-increment, then the default field list can go wrong


HTTP://1.LIURUITAO.SINAAPP.COM/TEST.PHP?NAME={0}
Obviously name should be obtained from the $_get array
$s =$_get["name"];

$sql = "INSERT into $db values (' 3344556677 ', $s, 3, ' 4 ', 5, ' 6 ', ' 7 ', ' 8 ', ' 9 ')";
Estimating the problem here
The general establishment of the table has a ... [Does the/quote client send this by post, or does it use get?

HTTP://1.LIURUITAO.SINAAPP.COM/TEST.PHP?NAME={0}
Obviously name should be obtained from the $_get array
$s =$_get["name"];

$sql = "INSERT into $db values (' 3344556677 ', $s, 3, ' 4 ', 5, ' 6 ', ' 7 ', ' 8 ', ' 9 ')";
Estimating the problem here
The general establishment of the table has a ...
Does my client use post, or do I receive it with a get?

Written in the URL, just use $_get.
$_post only gets the data passed by the POST method (in addition to uploading files)

Written in the URL, just use $_get.
$_post only gets the data passed by the POST method (in addition to uploading files)
Change to get also not, the database where can be inserted, I always change the value and then inserted, no duplicate primary key

$s =$_get["name"];
Echo $s;
Exit ();
Does this have an output?

$s =$_get["name"];
Echo $s;
Exit ();
Does this have an output?
No, he only asks this page when the program jumps in to read, no upload request He will not be able to enter the IF statement

$sql = "INSERT into $db values (' 3344556677 ', $s, 3, ' 4 ', 5, ' 6 ', ' 7 ', ' 8 ', ' 9 ')";
If $s no value, the actual SQL instruction executed is
Insert into table name values (' 3344556677 ',, 3, ' 4 ', 5, ' 6 ', ' 7 ', ' 8 ', ' 9 ')
It's obviously wrong.
Available through
mysql_query ($sql, $conn) or Die (Mysql_error ());
Know if this situation exists
Other than that
$sql = "INSERT into $db values (' 3344556677 ', $s, 3, ' 4 ', 5, ' 6 ', ' 7 ', ' 8 ', ' 9 ')";
Should write
$sql = "INSERT into $db values (' 3344556677 ', ' $s ', 3, ' 4 ', 5, ' 6 ', ' 7 ', ' 8 ', ' 9 ')";
So as not to happen accidentally.

$s =$_get["name"];
Echo $s;
Exit ();
Does this have an output?
I sizeof ($s) stored in the database is 1

$sql = "INSERT into $db values (' 3344556677 ', $s, 3, ' 4 ', 5, ' 6 ', ' 7 ', ' 8 ', ' 9 ')";
If $s no value, the actual SQL instruction executed is
Insert into table name values (' 3344556677 ',, 3, ' 4 ', 5, ' 6 ', ' 7 ', ' 8 ', ' 9 ')
It's obviously wrong.
Available through
Mysql_quer ...
Well, you said these 2 questions I have changed, behind me sizeof ($s) the results of the database is 1 from here can see what the problem is not

The local server can correctly get the sent string, put on Sina where it is not ... It seems that their platform has some rules ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.