Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your query is failing because you are using the <a href="http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html" rel="nofollow noreferrer">reserved keyword</a> <code>desc</code> without ticks. As a result the INSERT fails and thus no ID is returned.</p> <pre><code>$sql = "INSERT INTO Produkte (Name,Price,Desc,User) VALUES ('".$_POST['name']."','".$_POST['price']."','".$_POST['description']."','".$_SESSION['user']."');"; </code></pre> <p>should be</p> <pre><code>$sql = "INSERT INTO Produkte (Name,Price,`Desc`,User) VALUES ('".$_POST['name']."','".$_POST['price']."','".$_POST['description']."','".$_SESSION['user']."');"; </code></pre> <p><a href="https://stackoverflow.com/questions/12859942">Please, don't use <code>mysql_*</code> functions in new code</a>. They are no longer maintained <a href="https://wiki.php.net/rfc/mysql_deprecation" rel="nofollow noreferrer">and are officially deprecated</a>. See the <a href="http://uk.php.net/manual/en/function.mysql-connect.php" rel="nofollow noreferrer">red box</a>? Learn about <a href="https://en.wikipedia.org/wiki/Prepared_statement" rel="nofollow noreferrer"><em>prepared statements</em></a> instead, and use <a href="http://php.net/pdo" rel="nofollow noreferrer">PDO</a> or <a href="http://php.net/mysqli" rel="nofollow noreferrer">MySQLi</a> - <a href="http://php.net/manual/en/mysqlinfo.api.choosing.php" rel="nofollow noreferrer">this article</a> will help you decide which. If you choose PDO, <a href="http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers" rel="nofollow noreferrer">here is a good tutorial</a>.</p> <p><strong>You are also wide open to <a href="https://stackoverflow.com/q/60174">SQL injections</a></strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload