Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't Insert Into Database
    primarykey
    data
    text
    <p>I have a database, and I can't insert values into it. Here's my database and my code. </p> <p>Can you tell me what my problem is?</p> <p>The output tell me that my sql syntax is wrong. However, I can add values from phpmadmin without any problems. </p> <p>When I use code, I fail. And, I couldn't find any proble. </p> <p>Thank yuy very much. </p> <p><a href="http://i.imgur.com/pDhxz03.png" rel="nofollow">DATABASE</a></p> <pre><code>&lt;?php $db_username = "root"; $db_password = "pass"; $db = "rmado"; $db_server = "localhost"; $db_handle = mysql_connect($db_server, $db_username, $db_password); $db_found = mysql_select_db($db, $db_handle); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $title = $_POST['username']; $desc = $_POST['password']; $aaa = $_POST['type']; $bbb = $_POST['email']; $query = "insert into users(username, password, type, email) values ($title, $desc, $aaa, $bbb)"; mysql_query($query); } ?&gt; &lt;html&gt; &lt;body&gt; &lt;div id="login_form"&gt; &lt;form name="login_form" method="post" action="zort.php"&gt; username: &lt;input name="username" type="text" value=""&gt; password: &lt;input name="password" type="text" value=""&gt; type: &lt;input name="type" type="text" value=""&gt; email: &lt;input name="email" type="text" value=""&gt; &lt;input name="addtask" type="submit" value="add task"&gt; &lt;/form&gt; &lt;/div&gt; &lt;!-- end login_form--&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Thank you very much. </p> <p><strong>EDIT:</strong> </p> <p>id: int(5)</p> <p>title: varchar(30)</p> <p>desc: varchar(50)</p> <p>assigner_id: int(5)</p> <p>assignee_id: int(5)</p> <p>creation_date: date</p> <p>due_date: date</p> <p>status_id: int(5)</p> <p>category_id: int(5)</p> <p>and here's my php code: </p> <pre><code>$query = "insert into tasks (title, desc, assigner_id, assignee_id, creation_date, due_date, status_id, category_id) values ('$title', '$desc', $ass1, $ass2, '$cre', '$due', $stat, $cat)"; </code></pre> <p>Where's wrong in this code? Thank you very much. </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.
 

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