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 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算