非常奇怪、未知原因的内部服务器错误
当我请求此函数时,
//Add the content to the database
function articleadd() {
mysql_query("INSERT INTO site_content (title,content,reference,author,userid,authorip,day,month,year,token) VALUES ('$title','$articlebody','$reference','$author','$userid','$ipaddress','$day','$month','$year','$token')");
}
由于某种未知原因,它会产生内部服务器错误。老实说,我不知道为什么,我在下面请求这个函数,它工作得很好,
//Add a message if the user is not logged in
function message() {
mysql_query("INSERT INTO messages (from,to,subject,content,type,ip) VALUES ('$userid','$userid','The content $title is pending completion.','A article was attempted to be saved, however when the we tried to saved it there was no-one logged in. As a result we saved the article but quarantined it so it will not show on the website. To correct this error, please click the link below, review the article and confirm it should display on the site. <a href=$url>$url</a>','$type','$ipaddress')");
}
我一个接一个地请求它们,如下所示
articleadd()
message()
,在不起作用的函数中,用一个非常简单的函数替换了所有 mysql 查询
echo "hello world";
,但我得到错误。
我尝试过复制和粘贴一些东西,甚至是“功能”这个词,以确保我没有犯一个愚蠢的错误。不幸的是,我无法访问我的托管提供商的服务器日志。最后,我知道我没有传递变量,这是一个单独的问题,但基于没有变量和“hello world”测试的情况,这不可能是问题。
When I request this function
//Add the content to the database
function articleadd() {
mysql_query("INSERT INTO site_content (title,content,reference,author,userid,authorip,day,month,year,token) VALUES ('$title','$articlebody','$reference','$author','$userid','$ipaddress','$day','$month','$year','$token')");
}
For some unknown reason it produces a Internal Server Error. I honestly have no idea why, I request this function below and it works fine
//Add a message if the user is not logged in
function message() {
mysql_query("INSERT INTO messages (from,to,subject,content,type,ip) VALUES ('$userid','$userid','The content $title is pending completion.','A article was attempted to be saved, however when the we tried to saved it there was no-one logged in. As a result we saved the article but quarantined it so it will not show on the website. To correct this error, please click the link below, review the article and confirm it should display on the site. <a href=$url>$url</a>','$type','$ipaddress')");
}
With both I am requesting them one after the other as follows
articleadd()
message()
I have, in the function which does not work replaced all the mysql query with a very simple
echo "hello world";
And yet I get the error.
I have tried copying and pasting things even the word "function" to make sure I am not making a silly mistake. I unfortunately do not have access to the Server Log with my hosting provider. Lastly I am aware that I am not passing the variables, and that is a separate issue, but on the basis that one works with out variables and the "hello world" test this can not be the issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如我所看到的,函数内部使用的变量没有值。
您需要从参数或全局变量中设置 $userid、$author、$title 等变量的值
,然后像这样调用函数
As i can see, there is no values for the variables used inside the functions.
You need to set the values of the variables like $userid, $author, $title from parameters or global variables
And call the function like this