RFID RF Card Supermarket shopping settlement system problem record--when writing a card, background PHP cannot manipulate the database

Source: Internet
Author: User

Backstage Manager to each product affixed to the RF card as a unique identification, so to the corresponding RFID card to write the response information, I here in order to facilitate the simulation of the demo only write product number, price, name of these fields, and then to put the written goods uploaded backstage, Written from the background to the commodity table (Goods) in the database, where VB accesses the backend code as follows:

            'upload the contents of the card to the server, stored in the database by the server, later need to modify the URL and other content            DimSssa as NewWinHttpRequestDimURLString as String="http://mzwapitest.applinzi.com/"+"?"+"name="+"'"+ Goodsname +"'"Console.WriteLine (urlstring) Sssa. Open ("GET", URLString,False) Sssa. Send ()'if the string "OK" is returned, the successful identification of the write card is displayed            IfSssa. Responsetext.length ThenLabel6.text="Product Code:"+ Goodsnumb +"; product Name:"+ Goodsname +"; commodity Price:"+ Goodspric +"Write Success"+Sssa. ResponseTextElseiso15693_writemultipleblocks (HR, HT,0, the, Erasedata, Erasedata.count-1)            End If

PHP background is as follows:

<? Phpheader ("Content-type:text/html;charset = Utf-8"); $name= $_get['name '];$numb = $_get['Numb '];$price = $_get['Price '];//if($name = ="AAA") {    Echo'Mazhongwei ';//}//even the main library $db= Mysql_connect (sae_mysql_host_m.': '. Sae_mysql_port,sae_mysql_user,sae_mysql_pass);$db = mysql_connect (w.rdc.sae.sina.com.cn.': '. 3307,ilzy5im2l1w4im2hl13miwmy3ky3l10h1y3l4wkh);//Connect from library$db = mysql_connect (sae_mysql_host_s.': '. Sae_mysql_port,sae_mysql_user,sae_mysql_pass);if($db) {mysql_select_db (app_mzwapitest, $db); $ok= mysql_query ('INSERT into Goods (name) values ($name) ');   if($ok) {echo'OK ';}Else{echo'insert error ';   }        // ...}Else{echo'Openerror ';}?>

However, during the operation of the process is always not properly connected, after the PHP operation database statement after the day after the addition of a statement to receive the SQL operation failed prompt:

<? Phpheader ("Content-type:text/html;charset = Utf-8"); $name= $_get['name '];$numb = $_get['Numb '];$price = $_get['Price '];//if($name = ="AAA") {    Echo'Mazhongwei ';//}//even the main library $db= Mysql_connect (sae_mysql_host_m.': '. Sae_mysql_port,sae_mysql_user,sae_mysql_pass);$db = mysql_connect (w.rdc.sae.sina.com.cn.': '. 3307,ilzy5im2l1w4im2hl13miwmy3ky3l10h1y3l4wkh);//Connect from library$db = mysql_connect (sae_mysql_host_s.': '. Sae_mysql_port,sae_mysql_user,sae_mysql_pass);if($db) {mysql_select_db (app_mzwapitest, $db); $ok= mysql_query ('INSERT into Goods (name) VALUES ("$name");   if($ok) {echo'OK ';}Else{ echo mysql_error ();  Echo'insert error ';   }        // ...}Else{echo'Openerror ';}?>

Then you see the error message that is returned:

Unknown column ' $name ' in ' field list ' Insert error

The reasons for discovering online are:

So in the PHP statement to manipulate the MySQL statement to make the following changes

Before modification: $ok = mysql_query ('insert into Goods (name) values ($name) '); Modified: $ok = mysql_query ('insert into Goods (name) VALUES ("$name");

And then it's ready.

RFID RF Card Supermarket shopping settlement system problem record--when writing a card, background PHP cannot manipulate the database

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.