【问题标题】:php (form insertcell) add mysql columnphp (form insertcell) 添加 mysql 列
【发布时间】:2022-02-20 05:11:08
【问题描述】:

mysql如何添加列插入?因为insertCell 形式我不知道。我可以尝试,但我不能..添加 mysql 列。这是我的 php 代码 javascript 表单。其实我知道 Php pdo 但这很难,我想。

mysql如何添加列插入?

function myFunction1() {
  var table = document.getElementById("table1");
  var row = table.insertRow(-1);
  var cell1 = row.insertCell(0);
  var cell2 = row.insertCell(1);
  var cell3 = row.insertCell(2);
  var cell4 = row.insertCell(3);
  cell1.innerHTML = "<input name='agirlik' type='text' required='required'  placeholder='0'  style='width:90%; margin-top:15px;' onkeypress='return fun_AllowOnlyAmountAndDot(this.id);' onchange='this.value = this.value.replace(/,/g, '.')' autofocus>";
  cell2.innerHTML = "<input name='en' type='text'   style='width:90%;margin-top:15px;' placeholder='0' onkeypress='return fun_AllowOnlyAmountAndDot(this.id);' onchange='this.value = this.value.replace(/,/g, '.')'>";
  cell3.innerHTML = "<input name='boy' type='text' style='width:90%;margin-top:15px;' placeholder='0' onkeypress='return fun_AllowOnlyAmountAndDot(this.id);' onchange='this.value = this.value.replace(/,/g, '.')'>";
  cell4.innerHTML = "<input name='yuks' type='text' style='width:90%;margin-top:15px;'  placeholder='0' onkeypress='return fun_AllowOnlyAmountAndDot(this.id);' onchange='this.value = this.value.replace(/,/g, '.')'>";
}

function myDeleteFunction1() {
  document.getElementById("table1").deleteRow(-1);
}
<!DOCTYPE html>
<html>`enter code here`

<head>
  <title></title>
</head>

<body>
  <form method="post" action="add.php">
    <table width="550px" cellpadding="0" cellspacing="0" id="table1">
      <tr>
        <br>
        <td colspan="4"><a onclick="myFunction1()" style="color: #fff; margin-top: 10px"><i></i> Paket Ekle</a>&nbsp;&nbsp; <a onclick="myDeleteFunction1()" style="color: #000; margin-top: 10px"><i ></i> Paket Sil</a></td>

      </tr>
      <tr>
        <td height="40" valign="bottom"><strong>Paket Ağırlık (Kg.)</strong></td>
        <td valign="bottom"><strong>Eni  (cm.)</strong></td>
        <td valign="bottom"><strong>Boyu  (cm.)</strong></td>
        <td valign="bottom"><strong>Yüksekliği  (cm.)</strong></td>
      </tr>
      <tr>
        <td><input name="agirlik" type="text" required="" id="agirlik" placeholder="0" style="width:90%; margin-top: 15px"></td>
        <td><input name="en" type="text" id="en" placeholder="0" required="" style="width:90%; margin-top: 15px"></td>
        <td><input name="boy" type="text" id="boy" placeholder="0" required="" style="width:90%; margin-top: 15px"></td>
        <td><input name="yuks" type="text" id="yuks" placeholder="0" required="" style="width:90%; margin-top: 15px"></td>
      </tr>
    </table>
    <input type="submit" value="gonder">
  </form>
</body>

</html>

【问题讨论】:

  • 如果这与 PHP 相关并且您对此有疑问,则应将其添加到问题中。
  • 对不起,我不知道你在问什么,想做什么或者你卡在哪里。请编辑问题并尝试添加更多详细信息。另外发布的代码与 MySQL 或 PHP 有什么关系?
  • 对不起,我可以写遗漏,这是真的:
    而我的表名 = pack;我的表列 = id,agirlik,en,boy,yuks;一个问题=我的“add.php”页面应该如何?
  • 嗨,欢迎来到 Stack Overflow。现在,您的问题可能很快就会结束,因为它很广泛并且缺乏细节。您标记了许多似乎与您发布的任何代码无关的技术,并且您似乎要求我们编写您的整个函数以将数据插入数据库。如果您可以将问题减少到几个步骤,您更有可能获得有用的响应,也许是几行代码设置您的数据库连接,然后“当我调用 mysqli_query() 时,我总是得到一个 'database not selected '错误”或类似的特定内容。

标签: javascript php html mysql


【解决方案1】:

对不起,我可以写遗漏,这是真的:form action="add.php" method="post"

我的表名 = pack; 我的表列 = id,agirlik,en,boy,yuks;

一个问题 = 我的“add.php”页面应该是怎样的?

【讨论】:

  • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
  • 您应该编辑您的原始问题(上面应该有一个“编辑”链接),而不是发布额外的 cmets 作为“答案”。在这个网站上,很难看到答案与问题相关,并且随着更多答案或 cmets 出现,您的答案可能会进一步下降(或被彻底删除),这使得人们很难知道您添加了更多答案。
猜你喜欢
  • 1970-01-01
  • 2013-10-12
  • 1970-01-01
  • 2011-09-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多