简单的php脚本找不到对象错误 [英] Object Not Found error for simple php script

查看:116
本文介绍了简单的php脚本找不到对象错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我点击提交按钮来处理网页中的此代码时,都会转到找不到对象"(404错误)页面.它发生在我的一些脚本中,我不知道是我的localhost(Xampp)还是我的代码的问题根源.

Every time I hit the submit button to process this code in my webpage it goes to the Object Not Found (404 error) page. It has happened in a few of my scripts and i don't know the source of the problem of whether its my localhost(Xampp) or my code.

if (isset($_POST['submit']))
{
    require "dbc.php"; //Connection to database
    //the textfield input to be saved
    $name = mysql_real_escape_string($_POST['assign_id']);
    $id   = mysql_real_escape_string($_POST['id']);

    //the mysql query to process the textfield input
    $query = mysql_query("UPDATE users SET docID='$assign_id' WHERE id='$id'");
//normal statement to let the user know that the changes have been made.    
    echo "Doctor ID Successfully Assigned for Patient ID : $name ";
    echo "<p>Refresh page to view changes.</p>";
}   

推荐答案

您在查询中使用的是$assign_id,您早先获得了$_POST['assign_id']并将其存储到$name.

You are using $assign_id in your query, where you get the $_POST['assign_id'] earlier and store it to $name.

尝试将查询中的$assign_id更改为$name.

尝试将变量$name更改为$assign_id.

Try changing $assign_id in your query to $name.
or
Try changing you variable $name to $assign_id.

编辑

要检查的另一件事是,文件dbc.php是否与此文件位于同一目录中?

Another thing to check, is the file dbc.php in the same directory as this file?

编辑2

发布apache2/error.log文件的内容.这将显示未找到什么文件.

Post the contents of your apache2/error.log file. That will show what file was not found.

编辑3

为您添加代码<form>开头标记.您的action设置为什么?动作文件是否确实存在?

Post the code for you <form> opening tag. What is your action set to? Does the action file actually exist?

这篇关于简单的php脚本找不到对象错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆