Note that there are some explanatory texts on larger screens.

plurals
  1. POBasic PHP help - Column count doesn't match value count at row 1
    primarykey
    data
    text
    <p>I am trying to post into a database table, 3 different bits of information, but I get an error of <code>Column count doesn't match value count at row 1</code></p> <p>Here's my database table structure:</p> <pre><code> interestID int(11) auto_increment name varchar(100) categoryID int(11) interest_desc varchar(30) date timestamp </code></pre> <p>The form:</p> <pre><code>&lt;form id="form_design" method="post" action="interesting.php"&gt; &lt;fieldset id="input_1"&gt; &lt;input type="text" id="username" value="name?" /&gt; &lt;/fieldset&gt; &lt;fieldset id="input_2"&gt; &lt;input type="text" id="interest" value="your interest?" /&gt; &lt;/fieldset&gt; &lt;fieldset id="input_3&gt; &lt;select id="cats"&gt; &lt;option value=""&gt;--&lt;/option&gt; &lt;?php $sql = "SELECT categoryID, category_desc FROM categories "."ORDER BY category_desc"; $rs = mysql_query($sql); while($row = mysql_fetch_array($rs)) { echo "&lt;option value=\"".$row['categoryID']."\"&gt;".$row['category_desc']."&lt;/option&gt;\n "; } ?&gt; &lt;/select&gt; &lt;/fieldset&gt; &lt;input type="submit" name="submit" value="Submit" /&gt; &lt;/form&gt; </code></pre> <p>The php that inserts it into the table retrieves a column count doesn't match value count at row 1 </p> <p>PHP - </p> <pre><code>$interest_user = $_POST['username']; $interest_name = $_POST['interest']; $interest_cats = $_POST['cats']; mysql_query("INSERT INTO interests ( interestID, name, categoryID , interest_desc, date ) VALUES( "",'$interest_user' '$interest_cats' , '$interest_name', "" ) ") or die(mysql_error()); </code></pre>
    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.
 

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