dongxu8533486 2016-02-20 19:35
浏览 413
已采纳

HTTP错误405.0 - 不允许的方法

I have a have rented a server at www.unoeuro.com (I dont know if this matters) When i submit the form it gives me "HTTP Error 405.0 - Method Not Allowed"

<?php

define('DB_NAME', '');
define('DB_USER', '');
define('DB_PASSWORD', '');
define('DB_HOST', '')

$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);

if (!$link) {
 die('Could not connect: ' .mysql_error());
}

$db_selected = mysql_slect_db(DB_NAME, $link);

if (!$db_selected) {
 die('Could not connect: ' .mysql_error());
}

$value = $_POST['username'];

$sql = "INSERT INTO test (username) VALUES ('$value')";

if (!mysql_query($sql)) {
 die('Error: ' . mysql_error());
}
mysql_close();
?>
<!doctype HTML>
  <form action="test.php" method="post">
    <p>Username: <input type="text" name="username" /><p>
    <input type="submit" value="Submit" />
  </form>

Can anyone tell me what i am doing wrong? Just ask me for screenshots of anything you can use to help!

Sorry if the issue is obvious. This is my first time working with any kind of database, PHP and such.

Thanks!

</div>
  • 写回答

1条回答 默认 最新

  • donglie1994 2016-02-20 20:11
    关注

    First of all, if those are your actual database username and password, you're going to want to be changing those sharpish before someone else changes them for you :)

    It's most likely down to how your server is configured to handle PHP files.

    The first thing I would check is that the package you are leasing is designed to host PHP scripts. Looking at the UnoEuro package details (https://en.unoeuro.com/products.php#specs) it states 'ASP or PHP'. Is it possible that you are using a server setup for ASP?

    If you are definitely on a PHP package, I would contact the service provider. They should know everything there is to know about configuring your server.

    Also; there is a typo in your code 'mysql_slect_db'.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler