PHPPOST Upload, unable to read the uploaded string

Source: Internet
Author: User
PHPPOST Upload, unable to read the uploaded string local c # write with WebClient class http://1.liuruitao.sinaapp.com/test.php? Name = {0} is uploaded through this url.

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 ('20140901', $ s, 3, '4', 5, '6', '7', '8 ', '9 ')";
Mysql_query ($ SQL, $ conn); // use an SQL statement to insert data.
Mysql_close (); // Close the MySQL connection
Echo "insert success ";
}
The strings in the uploaded name cannot be correctly obtained and inserted into the database. thank you for your help.


Reply to discussion (solution)

Echo $ _ POST ["name"]; changed to print_r ($ _ REQUEST); give it a try.

Cannot get the value or insert the value?

Cannot get the value or insert the value? It seems that a value is obtained, but I cannot determine what it is. it cannot be inserted into the database. it seems to be a type problem.

Echo $ _ POST ["name"]; changed to print_r ($ _ REQUEST). If you try it, you can't try it. the code has been put on someone's server. I cannot control the execution.

Http://1.liuruitao.sinaapp.com/test.php? Name = {0}
Obviously, the name should be obtained from the $ _ GET array.
$ S = $ _ GET ["name"];

$ SQL = "insert into $ db values ('20140901', $ s, 3, '4', 5, '6', '7', '8 ', '9 ')";
It is estimated that the problem is here
Generally, when a table is created, a field is used as the unique primary key, and the primary key cannot be assigned a duplicate value. Otherwise, it is not unique.
If the primary key is auto-increment, an error may occur in the default field list.


Http://1.liuruitao.sinaapp.com/test.php? Name = {0}
Obviously, the name should be obtained from the $ _ GET array.
$ S = $ _ GET ["name"];

$ SQL = "insert into $ db values ('20140901', $ s, 3, '4', 5, '6', '7', '8 ', '9 ')";
It is estimated that the problem is here
Generally, when creating a table, there is ...... [/Quote does the client use POST to send the message, or GET?

Http://1.liuruitao.sinaapp.com/test.php? Name = {0}
Obviously, the name should be obtained from the $ _ GET array.
$ S = $ _ GET ["name"];

$ SQL = "insert into $ db values ('20140901', $ s, 3, '4', 5, '6', '7', '8 ', '9 ')";
It is estimated that the problem is here
Generally, when creating a table, there is ......
Does my client use POST to send messages or GET to receive messages?

$ _ GET is used in the url.
$ _ POST only obtains the data transmitted by the POST method (except for uploading files)

$ _ GET is used in the url.
$ _ POST only obtains the data transmitted by the POST method (except for uploading files)
It cannot be changed to get. Where can the database be inserted? I change the value once every time and insert it without repeating the primary key.

$ S = $ _ GET ["name"];
Echo $ s;
Exit ();
Is there output like this?

$ S = $ _ GET ["name"];
Echo $ s;
Exit ();
Is there output like this?
No, he only jumps in to read when requesting this page. he cannot enter the IF statement without an upload request.

$ SQL = "insert into $ db values ('20140901', $ s, 3, '4', 5, '6', '7', '8 ', '9 ')";
If $ s has no value, the actual executed SQL command is
Insert into table name values ('20170101', 3, '4', 5, '6', '7', '8', '9 ')
It is obviously wrong.
Available
Mysql_query ($ SQL, $ conn) or die (mysql_error ());
Know if this situation exists
In addition
$ SQL = "insert into $ db values ('20140901', $ s, 3, '4', 5, '6', '7', '8 ', '9 ')";
Ying writing
$ SQL = "insert into $ db values ('20140901', '$ S', 3, '4', 5, '6', '7', '8 ', '9 ')";
Avoid unexpected events

$ S = $ _ GET ["name"];
Echo $ s;
Exit ();
Is there output like this?
My sizeof ($ s) database contains 1

$ SQL = "insert into $ db values ('20140901', $ s, 3, '4', 5, '6', '7', '8 ', '9 ')";
If $ s has no value, the actual executed SQL command is
Insert into table name values ('20170101', 3, '4', 5, '6', '7', '8', '9 ')
It is obviously wrong.
Available
Mysql_quer ......
Well, I have changed the two questions you mentioned. later I sizeof ($ s) saved the result to database result 1. here I can see what the problem is.

The local server can correctly obtain the sent string. it won't work if it is placed on sina... it seems that there are some rules on their platform...

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.