-1

抱歉,这是一个相当大的页面,所以如果你可以查看这个并告诉我为什么它不更新我的数据库,但这里的 php 页面是我获取大学 ID 和我想要更新的值的第一页,并且只要点击投票它做了一个简单的数学方程来更新总数,然后除以得到百分比。

Sorry if you cant understand me been stressed over this project.

代码不会进入代码框,所以这里有链接。 在此处输入链接描述

顺便说一句,它在第 30 行,它没有更新到 db,但仅在 php 页面上!!

4

2 回答 2

0

Try removing the $con from the mysql_query() function calls. I've never had to reiterate a connection call, and it doesn't look like the documentation tells you place a second value in the function call.

于 2013-03-30T04:41:46.733 回答
0

You should wrap $math2 in line 30 in quotes, like this:

$sql3 = "UPDATE users_colleges SET percentage = '$math2' WHERE college_id = $Vcollege_id";

Integers don't need to be contained in quotes, but strings do -- and you added a '%' to $math2 in line 29, so it's no longer an integer.

Though, not sure if you need to store all the values with the '%' in the database... but if that's what you're doing, it needs to be in quotes.

于 2013-03-30T04:45:29.030 回答