drwurqczo39355510 2014-01-31 23:47
浏览 38
已采纳

来自WebForm的数据未输入数据库(MySQL)PHP

I have built a website have built a registration form. I have managed to get a connection with no errors, however the data isn't being entered from the form into the database. The code I have for the PHP is below...

$dbhost="refereelink.mysql";
$dbuser="        ";
$dbpass="        ";
$dbname="refereelink_com";

$conn = mysql_connect($dbhost, $dbuser, $dbpass)
or die (mysql_error());

mysql_select_db($dbname);


    if (isset($_POST['add'])){
        $firstname = $_POST['firstname'];
        $surname = $_POST['surname'];
        $dob = $_POST['dob'];
        $city = $_POST['city'];
        $r_country = $_POST['r_country'];
        $r_region = $_POST['r_region'];
        $r_level = $_POST['r_level'];
        $r_email = $_POST['r_email'];
        $r_contact_n = $_POST['r_contact_n'];
        $r_username = $_POST ['r_username'];
        $r_password =$_POST['r_password'];
        $membership_type =$_POST ['membership_type'];
        $insert=
            "INSERT INTO referees (firstname, surname, dob, city, r_country,  r_region, r_level, r_email, r_contact_n, r_username, r_password)
            VALUES    ('$firstname', '$surname', '$dob', '$city', '$r_county', '$r_region', '$r_level', '$r_email', '$r_contact_n', '$r_username', '$r_password')";
            mysql_query($insert) or die(mysql_error());
    }

Any help on this matter would be appreciated! I can't seem to work out what the issue is myself having checked it numerous times!

  • 写回答

2条回答 默认 最新

  • duandaoji3992 2014-02-11 22:41
    关注

    Solved the issue...

    I had included an extra field in the php code that wasn't in the database... school boy error really! Should of picked it up...

    Sjagr, reason for the host being as it is, is because its linked to the mysql from my domain host, so they set it to that and not local host unfortunately! It's a shame that my host doesn't allow access to local host with their service!

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

报告相同问题?

悬赏问题

  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?