当我尝试$ _GET for VALUES时,我收到错误

时间:2017-08-21 10:39:56

标签: equivalence

这是我试图开展工作的代码,但显然这不是一个可行的代码内容:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               exclude-result-prefixes="xsi">
    <xsl:output method="html" doctype-public="XSLT-compat" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" />

    <xsl:key name="properties" match="property" use="@key" />

    <xsl:template match="folder">
        <xsl:variable name="properties" select="//property[generate-id() = generate-id(key('properties', @key)[1])]/@key" />
        <table>
            <tr>
              <th>Name</th>
              <th>Type</th>
              <th>Text</th>
              <xsl:for-each select="$properties">
                <th><xsl:value-of select="."/></th>
              </xsl:for-each>
            </tr>
            <xsl:for-each select="element">
            <tr>
              <td>
                <xsl:value-of select="@name"/>
              </td>
              <td>
                <xsl:value-of select="@xsi:type"/>
              </td>
              <td>
                <xsl:value-of select="documentation"/>
              </td>
              <xsl:variable name="current" select="." />
              <xsl:for-each select="$properties">
                <td>
                  <xsl:for-each select="$current/property[@key=current()]/@value">
                    <xsl:if test="position() > 1">,</xsl:if>
                    <xsl:value-of select="." />
                  </xsl:for-each>
                </td>
              </xsl:for-each>
            </tr>
            </xsl:for-each>
        </table>
    </xsl:template>
</xsl:stylesheet>

我得到的错误:

$sql = "INSERT INTO users (name, pass)
VALUES ('$_GET['user'], '$_GET['pword']')";

1 个答案:

答案 0 :(得分:0)

首先确保您已在数据库中的users表上传递了列

我按照以下方式重写您的代码

$username = $_GET['user'];
$password = md5( $_GET['pword']);
$sql = "INSERT INTO users (name, pass) VALUES ($username,$password)";