数据库表没有通过php脚本正确填充 [英] Database table not populating properly by php script
问题描述
我正在尝试使用html表单和php脚本将一些数据插入到postgresql数据库表中。这里的问题是,当脚本运行时,它不会将数据插入到最后两个coulmns中,并且它会在第三列中插入0。
但是当我运行时使用此sql直接在数据库上查询
INSERT INTO作物(crop_id,crop_type,crop_name,cultivation_yrs,local_name)VALUES(''''''''food crop'',' 'garri', '' 6 '', '' 乌达拉 '');
它非常好地插入数据意味着我的PHP脚本出了问题
请有人帮忙告诉我我错过了什么在我的脚本中。
脚本1是我的html表单脚本。
你需要在字符串值周围包装引号展开 | 选择 | Wrap | 行号
我试图将字符串值包含在quites中,但它给了我这个错误
展开 | 选择 | Wrap | 行号
解析错误:语法错误,第21行的C:\ms4w \Apache \htdocs \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ PHP要求使用分号或点运算符来扩展字符串。
I am trying to insert some data into my postgresql database table using an html form and a php script. The problem here is that when the script is run, it does not insert data into the last two coulmns and also it would insert a 0 into the third column.
but when i run the query directly on the database using this sql
INSERT INTO crops (crop_id,crop_type,crop_name,cultivation_yrs, local_name)VALUES(''6'',''food crop'',''garri'',''6'',''utara'');
it inserts the data very well meaning that something is wrong with my php script
Please someone should help to tell me what im missing out in my scripts here.
script 1 is my html form script.
Expand|Select|Wrap|Line Numbers解决方案You need to wrap quotes around string valuesExpand|Select|Wrap|Line Numbers
I have tried to enclose the string values in quites but it is giving me this error
Expand|Select|Wrap|Line Numbers
Parse error: syntax error, unexpected T_VARIABLE in C:\ms4w\Apache\htdocs\php\inputcrops.php on line 21the double quotation marks end the string and PHP expects either a semicolon or a dot operator to extend the string.
这篇关于数据库表没有通过php脚本正确填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文登录 关闭
扫码关注1秒登录发送“验证码”获取 | 15天全站免登陆