我为我们的网站制作了一个脚本,让我们可以为客户创建/查看发票。在我的本地机器和GoDaddy托管上运行良好。完成所有操作后,托管(通过GoDaddy)脚本只有在发票而非报价脚本时才有效。它给了旧的
“您的SQL语法有错误;请查看与您的MySQL服务器版本对应的手册,以便在'quote(quotedate,customerID,customerName,customerAddr,description,amount,taxdue,t')附近使用正确的语法第1行“
当我尝试插入表格时。
同样,发票版本在我的本地主机(win7,webmatrix)上工作正常。两个脚本之间的唯一区别是我在发票中有$ matcost $ lacost(材料/人工成本)和$ amount(duh?)引用其他所有内容相同但我得到了错误。如果我回显我的$ sql查询,它告诉我它不是一个有效的链接资源,但所有的值都已被回显。
这是引用命令
mysql_query(
"INSERT INTO quote (
quotedate,
customerID,
customerName,
customerAddr,
description,
amount,
taxdue,
totaldue)
VALUES(
NOW(),
'$billto',
'$cust',
'$addr',
'$desc',
'$amount',
'$taxdue',
'$totaldue')
")
or die(mysql_error());
这是通过发票的命令
mysql_query(
"INSERT INTO invoice(
invdate,
customerID,
customerName,
customerAddr,
description,
material,
labour,
taxdue,
totaldue)
VALUES(
NOW(),
'$billto',
'$cust',
'$addr',
'$desc',
'$matcost',
'$labcost',
'$taxdue',
'$totaldue')")
or die(mysql_error());
答案 0 :(得分:1)
您提到If I echo my $sql query it tells me it's not a valid link resource
- 提示您在连接数据库时遇到问题,而不是实际查询。
答案 1 :(得分:0)
好吧,事实证明我的引用名称是错误。当使用PHPMyadmin运行查询时,它清楚地显示了我的1064错误,并且“引用”是问题。改名为合同,工作正常。