douhuan1950 2009-02-13 19:45
浏览 35
已采纳

通过php在mysql中错误的参数计数错误

I've been struggling with this for far too long, and I don't see any error.

I've got a table that holds a bunch of locations. When I'm adding a location via my php script, I get an error of 'Wrong parameter count for mysql_query()'.

When I echo the mysql query, everything looks fine,and I can copy and and paste it into phpmyAdmin , everything runs perfectly.

The query looks like this

INSERT IGNORE INTO locations (name, address, city, state, zip) VALUES ('Soboba Casino','23333 Soboba Road', 'San Jacinto', 'CA', '92581')

Am I missing something? Why would this not run in my script, but run in phpmyAdmin?

Sorry, Missed putting in the php, the offensive php seems pretty straight forward

// insert the venue
$insertLoc="INSERT IGNORE INTO locastions (loc, address, city, state, zip) VALUES ('$venueName','$streetAddress', '$city', '$state', '$zip')";
echo $insertLoc;
mysql_query($insertLoc)or die(mysql_query());
  • 写回答

4条回答 默认 最新

  • dongzhiqi0332 2009-02-13 20:03
    关注

    Try replacing the third line with

    mysql_query($insertLoc)or die(mysql_error());
    

    (Note that I've replaced the second mysql_query() with mysql_error().)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 html5+css有人可以帮吗?
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?